有人可以一劳永逸地解释无法调用 determinedVisibility() - 从未见过 pid 的连接

Could someone once and for all please explain Cannot call determinedVisibility() - never saw a connection for the pid

我目前正在通过 d3 将数据绘制成网络视图。自然地,当我尝试重新加载图形并向其提供新数据时,事情就发生了变化。这条可爱的线不断弹出:W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid.

我搜索了 SO 以寻求解释,但似乎没有任何定论。人们只是建议在 webview 设置中打开 DOM 存储(这显然不能解决问题)。我怀疑在重新加载图形和向其提供新数据之间存在竞争条件。我已经在我的 WebViewClient 中覆盖了 onPageFinished() 以调用侦听器将数据加载到图表中,认为它可以解决竞争条件,但无济于事。

谁能给我解释一下 W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid 是什么意思?我的评估有偏差吗?我该如何调试它?

如有任何提示,我们将不胜感激。

编辑:我已经解决了最初的问题,但我仍然很想了解那条线的含义。赏金。

这通常会在您覆盖方法 shouldOverrideUrlLoading() 时弹出。

从我之前应用程序的 WebView 用法来看,这是由于在 WebView 上呈现的内容,上面的方法捕获并依次忽略的内容。 当我加载的网站试图加载允许域之外的脚本时,我经常看到这种情况。

连续调用 loadUrl 导致竞争条件。问题是 loadUrl("file://..") 不会立即完成,因此当您调用 loadUrl("javascript:..") 时,它有时会在页面加载之前执行。
这就是我设置 webview:

的方式
wv = (CustomWebView) this.findViewById(R.id.webView1);

WebSettings wv_settings = wv.getSettings();

//this is where you fixed your code I guess
//And also by setting a WebClient to catch javascript's console messages :

wv.setWebChromeClient(new WebChromeClient() {
        public boolean onConsoleMessage(ConsoleMessage cm) {
            Log.d(TAG, cm.message() + " -- From line "
                    + cm.lineNumber() + " of "
                    + cm.sourceId() );
            return true;
        }
    });
wv_settings.setDomStorageEnabled(true);

wv.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            setTitle(view.getTitle());
            //do your stuff ...
            }
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (url.startsWith("file")) 
        {
            // Keep local assets in this WebView.
             return false;
        }
      }
    });

//wv.setWebViewClient(new HelpClient(this));//
wv.clearCache(true);
wv.clearHistory();
wv_settings.setJavaScriptEnabled(true);//XSS vulnerable
wv_settings.setJavaScriptCanOpenWindowsAutomatically(true);
wv.loadUrl("file:///android_asset/connect.php.html");

NOTE this line wv.setWebChromeClient(new WebChromeClient());

在 API 级别 19 (Android 4.4 KitKat) 中,浏览器引擎Android webkit 切换到 chromium webkit,几乎所有原始的 WebView API's 都包装到 chromium webkit.

的对应物中

这个方法,它给出了错误BindingManagerImpl.java), 来自 Chromium source:

@Override
public void determinedVisibility(int pid) {
    ManagedConnection managedConnection;
    synchronized (mManagedConnections) {
        managedConnection = mManagedConnections.get(pid);
    }
    if (managedConnection == null) {
        Log.w(TAG, "Cannot call determinedVisibility() - never saw a connection for the pid: "
                + "%d", pid);
        return;
    }


这是来自内容的渲染警告
您可以在那个 github 源代码中永远挖掘,可能很高兴看到方法 determinedVisibility(在 BindingManagerImpl.java 中)是从哪里调用的...(实现后缀“Impl”) . 希望这有帮助 ;O)