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/lib/main/aw_main_delegate.h" | 5 #include "android_webview/lib/main/aw_main_delegate.h" |
6 | 6 |
7 #include "android_webview/browser/aw_content_browser_client.h" | 7 #include "android_webview/browser/aw_content_browser_client.h" |
8 #include "android_webview/browser/in_process_renderer/in_process_renderer_client
.h" | |
9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 8 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
10 #include "android_webview/common/aw_switches.h" | 9 #include "android_webview/common/aw_switches.h" |
11 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" | 10 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" |
12 #include "android_webview/native/aw_geolocation_permission_context.h" | 11 #include "android_webview/native/aw_geolocation_permission_context.h" |
13 #include "android_webview/native/aw_quota_manager_bridge_impl.h" | 12 #include "android_webview/native/aw_quota_manager_bridge_impl.h" |
14 #include "android_webview/native/aw_web_contents_view_delegate.h" | 13 #include "android_webview/native/aw_web_contents_view_delegate.h" |
15 #include "android_webview/renderer/aw_content_renderer_client.h" | 14 #include "android_webview/renderer/aw_content_renderer_client.h" |
16 #include "base/command_line.h" | 15 #include "base/command_line.h" |
17 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
18 #include "base/logging.h" | 17 #include "base/logging.h" |
19 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
20 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
21 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
| 21 #include "content/public/browser/android/synchronous_compositor.h" |
22 #include "content/public/browser/browser_main_runner.h" | 22 #include "content/public/browser/browser_main_runner.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
25 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 25 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
26 | 26 |
27 namespace android_webview { | 27 namespace android_webview { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // TODO(boliu): Remove these global Allows once the underlying issues are | 31 // TODO(boliu): Remove these global Allows once the underlying issues are |
(...skipping 21 matching lines...) Expand all Loading... |
53 content::SetContentClient(&content_client_); | 53 content::SetContentClient(&content_client_); |
54 | 54 |
55 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl | 55 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl |
56 ::EnableVirtualizedContext(); | 56 ::EnableVirtualizedContext(); |
57 | 57 |
58 CommandLine* cl = CommandLine::ForCurrentProcess(); | 58 CommandLine* cl = CommandLine::ForCurrentProcess(); |
59 if (UIAndRendererCompositorThreadsNotMerged()) { | 59 if (UIAndRendererCompositorThreadsNotMerged()) { |
60 cl->AppendSwitch(cc::switches::kEnableCompositorFrameMessage); | 60 cl->AppendSwitch(cc::switches::kEnableCompositorFrameMessage); |
61 cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs); | 61 cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs); |
62 } else { | 62 } else { |
63 cl->AppendSwitch(switches::kEnableSynchronousRendererCompositor); | |
64 cl->AppendSwitch(switches::kEnableVsyncNotification); | 63 cl->AppendSwitch(switches::kEnableVsyncNotification); |
| 64 content::SynchronousCompositor::Init(); |
65 } | 65 } |
66 | 66 |
67 // WebView uses the existing Android View edge effect for overscroll glow. | 67 // WebView uses the existing Android View edge effect for overscroll glow. |
68 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 68 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
69 | 69 |
70 return false; | 70 return false; |
71 } | 71 } |
72 | 72 |
73 void AwMainDelegate::PreSandboxStartup() { | 73 void AwMainDelegate::PreSandboxStartup() { |
74 // TODO(torne): When we have a separate renderer process, we need to handle | 74 // TODO(torne): When we have a separate renderer process, we need to handle |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 content::ContentBrowserClient* | 118 content::ContentBrowserClient* |
119 AwMainDelegate::CreateContentBrowserClient() { | 119 AwMainDelegate::CreateContentBrowserClient() { |
120 content_browser_client_.reset(new AwContentBrowserClient(this)); | 120 content_browser_client_.reset(new AwContentBrowserClient(this)); |
121 return content_browser_client_.get(); | 121 return content_browser_client_.get(); |
122 } | 122 } |
123 | 123 |
124 content::ContentRendererClient* | 124 content::ContentRendererClient* |
125 AwMainDelegate::CreateContentRendererClient() { | 125 AwMainDelegate::CreateContentRendererClient() { |
126 // None of this makes sense for multiprocess. | 126 content_renderer_client_.reset(new AwContentRendererClient()); |
127 DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); | |
128 // During transition period allow running in either threading mode; eventually | |
129 // only the compositor/UI thread merge mode will be supported. | |
130 const bool no_merge_threads = UIAndRendererCompositorThreadsNotMerged(); | |
131 content_renderer_client_.reset( | |
132 no_merge_threads ? new AwContentRendererClient() : | |
133 new InProcessRendererClient()); | |
134 return content_renderer_client_.get(); | 127 return content_renderer_client_.get(); |
135 } | 128 } |
136 | 129 |
137 AwQuotaManagerBridge* AwMainDelegate::CreateAwQuotaManagerBridge( | 130 AwQuotaManagerBridge* AwMainDelegate::CreateAwQuotaManagerBridge( |
138 AwBrowserContext* browser_context) { | 131 AwBrowserContext* browser_context) { |
139 return new AwQuotaManagerBridgeImpl(browser_context); | 132 return new AwQuotaManagerBridgeImpl(browser_context); |
140 } | 133 } |
141 | 134 |
142 content::GeolocationPermissionContext* | 135 content::GeolocationPermissionContext* |
143 AwMainDelegate::CreateGeolocationPermission( | 136 AwMainDelegate::CreateGeolocationPermission( |
144 AwBrowserContext* browser_context) { | 137 AwBrowserContext* browser_context) { |
145 return AwGeolocationPermissionContext::Create(browser_context); | 138 return AwGeolocationPermissionContext::Create(browser_context); |
146 } | 139 } |
147 | 140 |
148 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( | 141 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( |
149 content::WebContents* web_contents) { | 142 content::WebContents* web_contents) { |
150 return AwWebContentsViewDelegate::Create(web_contents); | 143 return AwWebContentsViewDelegate::Create(web_contents); |
151 } | 144 } |
152 | 145 |
153 } // namespace android_webview | 146 } // namespace android_webview |
OLD | NEW |