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/gpu_memory_buffer_factory_impl.h" |
8 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
9 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" | 10 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" |
10 #include "android_webview/native/aw_geolocation_permission_context.h" | 11 #include "android_webview/native/aw_geolocation_permission_context.h" |
11 #include "android_webview/native/aw_quota_manager_bridge_impl.h" | 12 #include "android_webview/native/aw_quota_manager_bridge_impl.h" |
12 #include "android_webview/native/aw_web_contents_view_delegate.h" | 13 #include "android_webview/native/aw_web_contents_view_delegate.h" |
13 #include "android_webview/renderer/aw_content_renderer_client.h" | 14 #include "android_webview/renderer/aw_content_renderer_client.h" |
14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
15 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
18 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
19 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
20 #include "content/public/browser/browser_main_runner.h" | 21 #include "content/public/browser/browser_main_runner.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
23 #include "gpu/command_buffer/client/gl_in_process_context.h" | 24 #include "gpu/command_buffer/client/gl_in_process_context.h" |
24 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 25 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
25 | 26 |
26 namespace android_webview { | 27 namespace android_webview { |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 // TODO(boliu): Remove this global Allow once the underlying issues are | 31 // TODO(boliu): Remove this global Allow once the underlying issues are |
31 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. | 32 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. |
32 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > | 33 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > |
33 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; | 34 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; |
34 | 35 |
35 } | 36 } |
36 | 37 |
37 AwMainDelegate::AwMainDelegate() { | 38 AwMainDelegate::AwMainDelegate() |
| 39 : gpu_memory_buffer_factory_(new GpuMemoryBufferFactoryImpl) { |
38 } | 40 } |
39 | 41 |
40 AwMainDelegate::~AwMainDelegate() { | 42 AwMainDelegate::~AwMainDelegate() { |
41 } | 43 } |
42 | 44 |
43 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { | 45 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { |
44 content::SetContentClient(&content_client_); | 46 content::SetContentClient(&content_client_); |
45 | 47 |
46 gpu::GLInProcessContext::EnableVirtualizedContext(); | 48 gpu::GLInProcessContext::EnableVirtualizedContext(); |
| 49 gpu::GLInProcessContext::SetGpuMemoryBufferFactory( |
| 50 gpu_memory_buffer_factory_.get()); |
47 | 51 |
48 CommandLine* cl = CommandLine::ForCurrentProcess(); | 52 CommandLine* cl = CommandLine::ForCurrentProcess(); |
49 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); | 53 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); |
50 if (!cl->HasSwitch("disable-map-image")) | 54 if (!cl->HasSwitch("disable-map-image")) |
51 cl->AppendSwitch(cc::switches::kUseMapImage); | 55 cl->AppendSwitch(cc::switches::kUseMapImage); |
52 | 56 |
53 // WebView uses the Android system's scrollbars and overscroll glow. | 57 // WebView uses the Android system's scrollbars and overscroll glow. |
54 cl->AppendSwitch(switches::kHideScrollbars); | 58 cl->AppendSwitch(switches::kHideScrollbars); |
55 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 59 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
56 | 60 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 AwBrowserContext* browser_context) { | 119 AwBrowserContext* browser_context) { |
116 return AwGeolocationPermissionContext::Create(browser_context); | 120 return AwGeolocationPermissionContext::Create(browser_context); |
117 } | 121 } |
118 | 122 |
119 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( | 123 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( |
120 content::WebContents* web_contents) { | 124 content::WebContents* web_contents) { |
121 return AwWebContentsViewDelegate::Create(web_contents); | 125 return AwWebContentsViewDelegate::Create(web_contents); |
122 } | 126 } |
123 | 127 |
124 } // namespace android_webview | 128 } // namespace android_webview |
OLD | NEW |