Chromium Code Reviews| 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(); | |
|
boliu
2014/09/29 15:47:18
Still need cl to be defined.
reveman
2014/09/29 18:32:09
Done.
| |
| 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(use_zero_copy); |
|
boliu
2014/09/29 15:47:18
Clean this up and remove the use_zero_copy branch
reveman
2014/09/29 18:32:09
Done.
| |
| 69 | 55 |
| 70 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); | 56 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); |
| 71 cl->AppendSwitch(switches::kEnableImplSidePainting); | 57 cl->AppendSwitch(switches::kEnableImplSidePainting); |
| 72 | 58 |
| 73 // WebView uses the Android system's scrollbars and overscroll glow. | 59 // WebView uses the Android system's scrollbars and overscroll glow. |
| 74 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 60 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
| 75 | 61 |
| 76 // Not yet supported in single-process mode. | 62 // Not yet supported in single-process mode. |
| 77 cl->AppendSwitch(switches::kDisableSharedWorkers); | 63 cl->AppendSwitch(switches::kDisableSharedWorkers); |
| 78 | 64 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 | 151 |
| 166 #if defined(VIDEO_HOLE) | 152 #if defined(VIDEO_HOLE) |
| 167 content::ExternalVideoSurfaceContainer* | 153 content::ExternalVideoSurfaceContainer* |
| 168 AwMainDelegate::CreateExternalVideoSurfaceContainer( | 154 AwMainDelegate::CreateExternalVideoSurfaceContainer( |
| 169 content::WebContents* web_contents) { | 155 content::WebContents* web_contents) { |
| 170 return new ExternalVideoSurfaceContainerImpl(web_contents); | 156 return new ExternalVideoSurfaceContainerImpl(web_contents); |
| 171 } | 157 } |
| 172 #endif | 158 #endif |
| 173 | 159 |
| 174 } // namespace android_webview | 160 } // namespace android_webview |
| OLD | NEW |