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/browser_view_renderer.h" | 8 #include "android_webview/browser/browser_view_renderer.h" |
9 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" | |
10 #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" |
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_media_url_interceptor.h" | 11 #include "android_webview/native/aw_media_url_interceptor.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/native/aw_web_preferences_populater_impl.h" | 14 #include "android_webview/native/aw_web_preferences_populater_impl.h" |
16 #include "android_webview/native/external_video_surface_container_impl.h" | 15 #include "android_webview/native/external_video_surface_container_impl.h" |
17 #include "android_webview/renderer/aw_content_renderer_client.h" | 16 #include "android_webview/renderer/aw_content_renderer_client.h" |
18 #include "base/command_line.h" | 17 #include "base/command_line.h" |
19 #include "base/cpu.h" | 18 #include "base/cpu.h" |
(...skipping 13 matching lines...) Expand all Loading... |
33 | 32 |
34 namespace { | 33 namespace { |
35 | 34 |
36 // TODO(boliu): Remove this global Allow once the underlying issues are | 35 // TODO(boliu): Remove this global Allow once the underlying issues are |
37 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. | 36 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. |
38 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > | 37 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > |
39 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; | 38 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; |
40 | 39 |
41 } | 40 } |
42 | 41 |
43 AwMainDelegate::AwMainDelegate() | 42 AwMainDelegate::AwMainDelegate() { |
44 : gpu_memory_buffer_factory_(new GpuMemoryBufferFactoryImpl) { | |
45 } | 43 } |
46 | 44 |
47 AwMainDelegate::~AwMainDelegate() { | 45 AwMainDelegate::~AwMainDelegate() { |
48 } | 46 } |
49 | 47 |
50 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { | 48 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { |
51 content::SetContentClient(&content_client_); | 49 content::SetContentClient(&content_client_); |
52 | 50 |
53 CommandLine* cl = CommandLine::ForCurrentProcess(); | |
54 bool zero_copy_disabled_by_switch = cl->HasSwitch(switches::kDisableZeroCopy); | |
55 bool use_zero_copy = !zero_copy_disabled_by_switch && | |
56 cl->HasSwitch(switches::kEnableZeroCopy) && | |
57 gpu_memory_buffer_factory_.get()->Initialize(); | |
58 | |
59 if (use_zero_copy) { | |
60 cl->AppendSwitch(switches::kEnableZeroCopy); | |
61 } else if (!zero_copy_disabled_by_switch) { | |
62 cl->AppendSwitch(switches::kDisableZeroCopy); | |
63 } | |
64 | |
65 content::BrowserMediaPlayerManager::RegisterMediaUrlInterceptor( | 51 content::BrowserMediaPlayerManager::RegisterMediaUrlInterceptor( |
66 new AwMediaUrlInterceptor()); | 52 new AwMediaUrlInterceptor()); |
67 | 53 |
68 BrowserViewRenderer::CalculateTileMemoryPolicy(use_zero_copy); | 54 BrowserViewRenderer::CalculateTileMemoryPolicy(); |
69 | 55 |
| 56 CommandLine* cl = CommandLine::ForCurrentProcess(); |
70 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); | 57 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); |
71 cl->AppendSwitch(switches::kEnableImplSidePainting); | 58 cl->AppendSwitch(switches::kEnableImplSidePainting); |
72 | 59 |
73 // WebView uses the Android system's scrollbars and overscroll glow. | 60 // WebView uses the Android system's scrollbars and overscroll glow. |
74 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 61 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
75 | 62 |
76 // Not yet supported in single-process mode. | 63 // Not yet supported in single-process mode. |
77 cl->AppendSwitch(switches::kDisableSharedWorkers); | 64 cl->AppendSwitch(switches::kDisableSharedWorkers); |
78 | 65 |
79 // File system API not supported (requires some new API; internal bug 6930981) | 66 // File system API not supported (requires some new API; internal bug 6930981) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 152 |
166 #if defined(VIDEO_HOLE) | 153 #if defined(VIDEO_HOLE) |
167 content::ExternalVideoSurfaceContainer* | 154 content::ExternalVideoSurfaceContainer* |
168 AwMainDelegate::CreateExternalVideoSurfaceContainer( | 155 AwMainDelegate::CreateExternalVideoSurfaceContainer( |
169 content::WebContents* web_contents) { | 156 content::WebContents* web_contents) { |
170 return new ExternalVideoSurfaceContainerImpl(web_contents); | 157 return new ExternalVideoSurfaceContainerImpl(web_contents); |
171 } | 158 } |
172 #endif | 159 #endif |
173 | 160 |
174 } // namespace android_webview | 161 } // namespace android_webview |
OLD | NEW |