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