| 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/scoped_allow_wait_for_legacy_web_view_api.h" | 9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
| 10 #include "android_webview/common/aw_descriptors.h" | 10 #include "android_webview/common/aw_descriptors.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
| 28 #include "base/threading/thread_restrictions.h" | 28 #include "base/threading/thread_restrictions.h" |
| 29 #include "cc/base/switches.h" | 29 #include "cc/base/switches.h" |
| 30 #include "components/external_video_surface/browser/android/external_video_surfa
ce_container_impl.h" | 30 #include "components/external_video_surface/browser/android/external_video_surfa
ce_container_impl.h" |
| 31 #include "content/public/browser/android/browser_media_player_manager_register.h
" | 31 #include "content/public/browser/android/browser_media_player_manager_register.h
" |
| 32 #include "content/public/browser/browser_main_runner.h" | 32 #include "content/public/browser/browser_main_runner.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/common/content_descriptors.h" | 34 #include "content/public/common/content_descriptors.h" |
| 35 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.h" |
| 36 #include "gin/public/isolate_holder.h" | 36 #include "gin/public/isolate_holder.h" |
| 37 #include "gin/v8_initializer.h" |
| 37 #include "gpu/command_buffer/client/gl_in_process_context.h" | 38 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 38 #include "gpu/command_buffer/service/gpu_switches.h" | 39 #include "gpu/command_buffer/service/gpu_switches.h" |
| 39 #include "media/base/media_switches.h" | 40 #include "media/base/media_switches.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 41 #include "ui/events/gesture_detection/gesture_configuration.h" | 42 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 42 | 43 |
| 43 namespace android_webview { | 44 namespace android_webview { |
| 44 | 45 |
| 45 namespace { | 46 namespace { |
| 46 | 47 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // http://crbug.com/479767 | 111 // http://crbug.com/479767 |
| 111 cl->AppendSwitch(switches::kEnableAggressiveDOMStorageFlushing); | 112 cl->AppendSwitch(switches::kEnableAggressiveDOMStorageFlushing); |
| 112 | 113 |
| 113 // Webview does not currently support the Presentation API, see | 114 // Webview does not currently support the Presentation API, see |
| 114 // https://crbug.com/521319 | 115 // https://crbug.com/521319 |
| 115 cl->AppendSwitch(switches::kDisablePresentationAPI); | 116 cl->AppendSwitch(switches::kDisablePresentationAPI); |
| 116 | 117 |
| 117 if (cl->GetSwitchValueASCII(switches::kProcessType).empty()) { | 118 if (cl->GetSwitchValueASCII(switches::kProcessType).empty()) { |
| 118 // Browser process (no type specified). | 119 // Browser process (no type specified). |
| 119 | 120 |
| 120 // This code is needed to be able to mmap the V8 snapshot directly from | 121 base::android::RegisterApkAssetWithGlobalDescriptors( |
| 121 // the WebView .apk using architecture-specific names. | 122 kV8NativesDataDescriptor32, |
| 122 // This needs to be here so that it gets to run before the code in | 123 gin::V8Initializer::GetNativesFilePath(true).AsUTF8Unsafe()); |
| 123 // content_main_runner that reads these values tries to do so. | 124 base::android::RegisterApkAssetWithGlobalDescriptors( |
| 124 #ifdef __LP64__ | 125 kV8SnapshotDataDescriptor32, |
| 125 const char kNativesFileName[] = "assets/natives_blob_64.bin"; | 126 gin::V8Initializer::GetSnapshotFilePath(true).AsUTF8Unsafe()); |
| 126 const char kSnapshotFileName[] = "assets/snapshot_blob_64.bin"; | 127 |
| 127 #else | 128 base::android::RegisterApkAssetWithGlobalDescriptors( |
| 128 const char kNativesFileName[] = "assets/natives_blob_32.bin"; | 129 kV8NativesDataDescriptor64, |
| 129 const char kSnapshotFileName[] = "assets/snapshot_blob_32.bin"; | 130 gin::V8Initializer::GetNativesFilePath(false).AsUTF8Unsafe()); |
| 130 #endif // __LP64__ | 131 base::android::RegisterApkAssetWithGlobalDescriptors( |
| 131 // TODO(gsennton) we should use | 132 kV8SnapshotDataDescriptor64, |
| 132 // gin::IsolateHolder::kNativesFileName/kSnapshotFileName | 133 gin::V8Initializer::GetSnapshotFilePath(false).AsUTF8Unsafe()); |
| 133 // here when those files have arch specific names http://crbug.com/455699 | |
| 134 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( | |
| 135 kV8NativesDataDescriptor, kNativesFileName)); | |
| 136 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( | |
| 137 kV8SnapshotDataDescriptor, kSnapshotFileName)); | |
| 138 } | 134 } |
| 139 | 135 |
| 140 if (cl->HasSwitch(switches::kWebViewSandboxedRenderer)) { | 136 if (cl->HasSwitch(switches::kWebViewSandboxedRenderer)) { |
| 141 cl->AppendSwitch(switches::kInProcessGPU); | 137 cl->AppendSwitch(switches::kInProcessGPU); |
| 142 cl->AppendSwitchASCII(switches::kRendererProcessLimit, "1"); | 138 cl->AppendSwitchASCII(switches::kRendererProcessLimit, "1"); |
| 143 cl->AppendSwitch(switches::kDisableRendererBackgrounding); | 139 cl->AppendSwitch(switches::kDisableRendererBackgrounding); |
| 144 } | 140 } |
| 145 | 141 |
| 146 return false; | 142 return false; |
| 147 } | 143 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 #if defined(VIDEO_HOLE) | 248 #if defined(VIDEO_HOLE) |
| 253 content::ExternalVideoSurfaceContainer* | 249 content::ExternalVideoSurfaceContainer* |
| 254 AwMainDelegate::CreateExternalVideoSurfaceContainer( | 250 AwMainDelegate::CreateExternalVideoSurfaceContainer( |
| 255 content::WebContents* web_contents) { | 251 content::WebContents* web_contents) { |
| 256 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( | 252 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( |
| 257 web_contents); | 253 web_contents); |
| 258 } | 254 } |
| 259 #endif | 255 #endif |
| 260 | 256 |
| 261 } // namespace android_webview | 257 } // namespace android_webview |
| OLD | NEW |