Chromium Code Reviews| Index: android_webview/browser/in_process_view_renderer.cc |
| diff --git a/android_webview/browser/in_process_renderer/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc |
| similarity index 95% |
| rename from android_webview/browser/in_process_renderer/in_process_view_renderer.cc |
| rename to android_webview/browser/in_process_view_renderer.cc |
| index 0121f11e45a7266a86c2a866160a07671539e3a4..01470f7c33b2b2425385dc511d9443f96d2c8d91 100644 |
| --- a/android_webview/browser/in_process_renderer/in_process_view_renderer.cc |
| +++ b/android_webview/browser/in_process_view_renderer.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "android_webview/browser/in_process_renderer/in_process_view_renderer.h" |
| +#include "android_webview/browser/in_process_view_renderer.h" |
| #include <android/bitmap.h> |
| @@ -12,9 +12,9 @@ |
| #include "base/debug/trace_event.h" |
| #include "base/logging.h" |
| #include "content/public/browser/android/content_view_core.h" |
| +#include "content/public/browser/android/synchronous_compositor.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| -#include "content/public/renderer/android/synchronous_compositor.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| #include "third_party/skia/include/core/SkCanvas.h" |
| #include "third_party/skia/include/core/SkDevice.h" |
| @@ -278,8 +278,6 @@ InProcessViewRenderer::InProcessViewRenderer( |
| } |
| InProcessViewRenderer::~InProcessViewRenderer() { |
| - if (compositor_) |
| - compositor_->SetClient(NULL); |
| SetContents(NULL); |
|
mkosiba (inactive)
2013/05/30 11:05:29
add a DCHECK(compositor_ == NULL)?
joth
2013/05/30 19:18:05
Done.
|
| } |
| @@ -289,33 +287,12 @@ InProcessViewRenderer* InProcessViewRenderer::FromWebContents( |
| return UserData::GetInstance(contents); |
| } |
| -// static |
| -InProcessViewRenderer* InProcessViewRenderer::FromId(int render_process_id, |
| - int render_view_id) { |
| - const content::RenderViewHost* rvh = |
| - content::RenderViewHost::FromID(render_process_id, render_view_id); |
| - if (!rvh) return NULL; |
| - return InProcessViewRenderer::FromWebContents( |
| - content::WebContents::FromRenderViewHost(rvh)); |
| -} |
| - |
| -void InProcessViewRenderer::BindSynchronousCompositor( |
| - content::SynchronousCompositor* compositor) { |
| - DCHECK(compositor && compositor_ != compositor); |
| - if (compositor_) |
| - compositor_->SetClient(NULL); |
| - compositor_ = compositor; |
| - hardware_initialized_ = false; |
| - hardware_failed_ = false; |
| - compositor_->SetClient(this); |
| - |
| - if (attached_to_window_) |
| - client_->RequestProcessMode(); |
| -} |
| - |
| void InProcessViewRenderer::SetContents( |
| content::ContentViewCore* content_view_core) { |
| // First remove association from the prior ContentViewCore / WebContents. |
| + if (compositor_) |
| + compositor_->SetClient(NULL); |
| + compositor_ = NULL; |
| if (web_contents_) { |
| web_contents_->SetUserData(kUserDataKey, NULL); |
| DCHECK(!web_contents_); // WebContentsGone should have been called. |
| @@ -326,6 +303,10 @@ void InProcessViewRenderer::SetContents( |
| web_contents_ = content_view_core->GetWebContents(); |
| web_contents_->SetUserData(kUserDataKey, new UserData(this)); |
| + content::SynchronousCompositor::GetOrCreateForWebContents(web_contents_)-> |
| + SetClient(this); |
| + // Currently the logic in this class relies on |compositor_| remaining NULL |
| + // until the DidInitializeCompositor() call, hence it is not set here. |
| } |
| void InProcessViewRenderer::WebContentsGone() { |
| @@ -549,12 +530,21 @@ gfx::Rect InProcessViewRenderer::GetScreenRect() { |
| return gfx::Rect(client_->GetLocationOnScreen(), gfx::Size(width_, height_)); |
| } |
| +void InProcessViewRenderer::DidInitializeCompositor( |
| + content::SynchronousCompositor* compositor) { |
| + DCHECK(compositor && compositor_ == NULL); |
| + compositor_ = compositor; |
| + hardware_initialized_ = false; |
| + hardware_failed_ = false; |
| + |
| + if (attached_to_window_) |
| + client_->RequestProcessMode(); |
| +} |
| + |
| void InProcessViewRenderer::DidDestroyCompositor( |
| content::SynchronousCompositor* compositor) { |
| - // Allow for transient hand-over when two compositors may reference |
| - // a single client. |
| - if (compositor_ == compositor) |
| - compositor_ = NULL; |
| + DCHECK(compositor_ == compositor); |
| + compositor_ = NULL; |
| } |
| void InProcessViewRenderer::SetContinuousInvalidate(bool invalidate) { |