| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "android_webview/browser/in_process_renderer/in_process_renderer_client
.h" | |
| 6 | |
| 7 #include "android_webview/browser/in_process_renderer/in_process_view_renderer.h
" | |
| 8 #include "content/public/browser/browser_thread.h" | |
| 9 #include "content/public/browser/render_process_host.h" | |
| 10 | |
| 11 namespace android_webview { | |
| 12 | |
| 13 namespace { | |
| 14 | |
| 15 int GetInProcessRendererId() { | |
| 16 content::RenderProcessHost::iterator it = | |
| 17 content::RenderProcessHost::AllHostsIterator(); | |
| 18 if (it.IsAtEnd()) { | |
| 19 // There should always be one RPH in single process more. | |
| 20 NOTREACHED(); | |
| 21 return 0; | |
| 22 } | |
| 23 | |
| 24 int id = it.GetCurrentValue()->GetID(); | |
| 25 it.Advance(); | |
| 26 DCHECK(it.IsAtEnd()); // Not multiprocess compatible. | |
| 27 return id; | |
| 28 } | |
| 29 | |
| 30 } | |
| 31 | |
| 32 MessageLoop* InProcessRendererClient::OverrideCompositorMessageLoop() const { | |
| 33 MessageLoop* rv = content::BrowserThread::UnsafeGetMessageLoopForThread( | |
| 34 content::BrowserThread::UI); | |
| 35 DCHECK(rv); | |
| 36 return rv; | |
| 37 } | |
| 38 | |
| 39 void InProcessRendererClient::DidCreateSynchronousCompositor( | |
| 40 int render_view_id, | |
| 41 content::SynchronousCompositor* compositor) { | |
| 42 InProcessViewRenderer* view_renderer = | |
| 43 InProcessViewRenderer::FromId(GetInProcessRendererId(), render_view_id); | |
| 44 if (view_renderer) | |
| 45 view_renderer->BindSynchronousCompositor(compositor); | |
| 46 } | |
| 47 | |
| 48 bool InProcessRendererClient::ShouldCreateCompositorInputHandler() const { | |
| 49 // Compositor input handling will be performed by the renderer host | |
| 50 // when UI and compositor threads are merged, so we disable client compositor | |
| 51 // input handling in this case. | |
| 52 return false; | |
| 53 } | |
| 54 | |
| 55 } // namespace android_webview | |
| OLD | NEW |