| 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 base::MessageLoop* InProcessRendererClient::OverrideCompositorMessageLoop() | |
| 33 const { | |
| 34 base::MessageLoop* rv = content::BrowserThread::UnsafeGetMessageLoopForThread( | |
| 35 content::BrowserThread::UI); | |
| 36 DCHECK(rv); | |
| 37 return rv; | |
| 38 } | |
| 39 | |
| 40 void InProcessRendererClient::DidCreateSynchronousCompositor( | |
| 41 int render_view_id, | |
| 42 content::SynchronousCompositor* compositor) { | |
| 43 InProcessViewRenderer* view_renderer = | |
| 44 InProcessViewRenderer::FromId(GetInProcessRendererId(), render_view_id); | |
| 45 if (view_renderer) | |
| 46 view_renderer->BindSynchronousCompositor(compositor); | |
| 47 } | |
| 48 | |
| 49 bool InProcessRendererClient::ShouldCreateCompositorInputHandler() const { | |
| 50 // Compositor input handling will be performed by the renderer host | |
| 51 // when UI and compositor threads are merged, so we disable client compositor | |
| 52 // input handling in this case. | |
| 53 return false; | |
| 54 } | |
| 55 | |
| 56 } // namespace android_webview | |
| OLD | NEW |