| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "android_webview/browser/in_process_renderer/in_process_renderer_client
.h" | 5 #include "android_webview/browser/in_process_renderer/in_process_renderer_client
.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/browser_view_renderer_impl.h" | 7 #include "android_webview/browser/browser_view_renderer.h" |
| 8 #include "android_webview/renderer/aw_render_view_ext.h" |
| 8 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| 10 | 11 |
| 11 namespace android_webview { | 12 namespace android_webview { |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 int GetInProcessRendererId() { | 16 int GetInProcessRendererId() { |
| 16 content::RenderProcessHost::iterator it = | 17 content::RenderProcessHost::iterator it = |
| 17 content::RenderProcessHost::AllHostsIterator(); | 18 content::RenderProcessHost::AllHostsIterator(); |
| 18 if (it.IsAtEnd()) { | 19 if (it.IsAtEnd()) { |
| 19 // There should always be one RPH in single process more. | 20 // There should always be one RPH in single process more. |
| 20 NOTREACHED(); | 21 NOTREACHED(); |
| 21 return 0; | 22 return 0; |
| 22 } | 23 } |
| 23 | 24 |
| 24 int id = it.GetCurrentValue()->GetID(); | 25 int id = it.GetCurrentValue()->GetID(); |
| 25 it.Advance(); | 26 it.Advance(); |
| 26 DCHECK(it.IsAtEnd()); // Not multiprocess compatible. | 27 DCHECK(it.IsAtEnd()); // Not multiprocess compatible. |
| 27 return id; | 28 return id; |
| 28 } | 29 } |
| 29 | 30 |
| 30 } | 31 } |
| 31 | 32 |
| 33 void InProcessRendererClient::RenderViewCreated( |
| 34 content::RenderView* render_view) { |
| 35 AwRenderViewExt::RenderViewCreated(render_view); |
| 36 } |
| 37 |
| 32 MessageLoop* InProcessRendererClient::OverrideCompositorMessageLoop() const { | 38 MessageLoop* InProcessRendererClient::OverrideCompositorMessageLoop() const { |
| 33 MessageLoop* rv = content::BrowserThread::UnsafeGetMessageLoopForThread( | 39 MessageLoop* rv = content::BrowserThread::UnsafeGetMessageLoopForThread( |
| 34 content::BrowserThread::UI); | 40 content::BrowserThread::UI); |
| 35 DCHECK(rv); | 41 DCHECK(rv); |
| 36 return rv; | 42 return rv; |
| 37 } | 43 } |
| 38 | 44 |
| 39 void InProcessRendererClient::DidCreateSynchronousCompositor( | 45 void InProcessRendererClient::DidCreateSynchronousCompositor( |
| 40 int render_view_id, | 46 int render_view_id, |
| 41 content::SynchronousCompositor* compositor) { | 47 content::SynchronousCompositor* compositor) { |
| 42 BrowserViewRendererImpl* view_renderer = | 48 BrowserViewRenderer* view_renderer = |
| 43 BrowserViewRendererImpl::FromId(GetInProcessRendererId(), render_view_id); | 49 BrowserViewRenderer::FromId(GetInProcessRendererId(), render_view_id); |
| 44 if (view_renderer) | 50 if (view_renderer) |
| 45 view_renderer->BindSynchronousCompositor(compositor); | 51 view_renderer->BindSynchronousCompositor(compositor); |
| 46 } | 52 } |
| 47 | 53 |
| 48 bool InProcessRendererClient::ShouldCreateCompositorInputHandler() const { | 54 bool InProcessRendererClient::ShouldCreateCompositorInputHandler() const { |
| 49 // Compositor input handling will be performed by the renderer host | 55 // Compositor input handling will be performed by the renderer host |
| 50 // when UI and compositor threads are merged, so we disable client compositor | 56 // when UI and compositor threads are merged, so we disable client compositor |
| 51 // input handling in this case. | 57 // input handling in this case. |
| 52 return false; | 58 return false; |
| 53 } | 59 } |
| 54 | 60 |
| 55 } // namespace android_webview | 61 } // namespace android_webview |
| OLD | NEW |