Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: content/shell/browser/shell_content_browser_client.cc

Issue 1011133006: Move V8 snapshot loading code from isolate_holder to gin/v8_startup_data.{h,cc}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing #ifdef in V8Initializer::Initialize. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/shell/DEPS ('k') | content/test/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell_content_browser_client.h" 5 #include "content/shell/browser/shell_content_browser_client.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 16 matching lines...) Expand all
27 #include "content/shell/browser/shell_browser_main_parts.h" 27 #include "content/shell/browser/shell_browser_main_parts.h"
28 #include "content/shell/browser/shell_devtools_manager_delegate.h" 28 #include "content/shell/browser/shell_devtools_manager_delegate.h"
29 #include "content/shell/browser/shell_net_log.h" 29 #include "content/shell/browser/shell_net_log.h"
30 #include "content/shell/browser/shell_quota_permission_context.h" 30 #include "content/shell/browser/shell_quota_permission_context.h"
31 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" 31 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h"
32 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h" 32 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h"
33 #include "content/shell/browser/webkit_test_controller.h" 33 #include "content/shell/browser/webkit_test_controller.h"
34 #include "content/shell/common/shell_messages.h" 34 #include "content/shell/common/shell_messages.h"
35 #include "content/shell/common/shell_switches.h" 35 #include "content/shell/common/shell_switches.h"
36 #include "content/shell/common/webkit_test_helpers.h" 36 #include "content/shell/common/webkit_test_helpers.h"
37 #include "gin/public/isolate_holder.h" 37 #include "gin/v8_initializer.h"
38 #include "net/url_request/url_request_context_getter.h" 38 #include "net/url_request/url_request_context_getter.h"
39 #include "url/gurl.h" 39 #include "url/gurl.h"
40 40
41 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
42 #include "base/android/path_utils.h" 42 #include "base/android/path_utils.h"
43 #include "components/crash/browser/crash_dump_manager_android.h" 43 #include "components/crash/browser/crash_dump_manager_android.h"
44 #include "content/shell/android/shell_descriptors.h" 44 #include "content/shell/android/shell_descriptors.h"
45 #endif 45 #endif
46 46
47 #if defined(OS_POSIX) && !defined(OS_MACOSX) 47 #if defined(OS_POSIX) && !defined(OS_MACOSX)
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 329
330 #if defined(OS_POSIX) && !defined(OS_MACOSX) 330 #if defined(OS_POSIX) && !defined(OS_MACOSX)
331 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 331 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
332 const base::CommandLine& command_line, 332 const base::CommandLine& command_line,
333 int child_process_id, 333 int child_process_id,
334 FileDescriptorInfo* mappings) { 334 FileDescriptorInfo* mappings) {
335 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 335 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
336 if (v8_snapshot_fd_.get() == -1 && v8_natives_fd_.get() == -1) { 336 if (v8_snapshot_fd_.get() == -1 && v8_natives_fd_.get() == -1) {
337 base::FilePath v8_data_path; 337 base::FilePath v8_data_path;
338 PathService::Get(gin::IsolateHolder::kV8SnapshotBasePathKey, &v8_data_path); 338 PathService::Get(gin::V8Initializer::kV8SnapshotBasePathKey, &v8_data_path);
339 DCHECK(!v8_data_path.empty()); 339 DCHECK(!v8_data_path.empty());
340 340
341 int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ; 341 int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
342 base::FilePath v8_natives_data_path = 342 base::FilePath v8_natives_data_path =
343 v8_data_path.AppendASCII(gin::IsolateHolder::kNativesFileName); 343 v8_data_path.AppendASCII(gin::V8Initializer::kNativesFileName);
344 base::FilePath v8_snapshot_data_path = 344 base::FilePath v8_snapshot_data_path =
345 v8_data_path.AppendASCII(gin::IsolateHolder::kSnapshotFileName); 345 v8_data_path.AppendASCII(gin::V8Initializer::kSnapshotFileName);
346 base::File v8_natives_data_file(v8_natives_data_path, file_flags); 346 base::File v8_natives_data_file(v8_natives_data_path, file_flags);
347 base::File v8_snapshot_data_file(v8_snapshot_data_path, file_flags); 347 base::File v8_snapshot_data_file(v8_snapshot_data_path, file_flags);
348 DCHECK(v8_natives_data_file.IsValid()); 348 DCHECK(v8_natives_data_file.IsValid());
349 DCHECK(v8_snapshot_data_file.IsValid()); 349 DCHECK(v8_snapshot_data_file.IsValid());
350 v8_natives_fd_.reset(v8_natives_data_file.TakePlatformFile()); 350 v8_natives_fd_.reset(v8_natives_data_file.TakePlatformFile());
351 v8_snapshot_fd_.reset(v8_snapshot_data_file.TakePlatformFile()); 351 v8_snapshot_fd_.reset(v8_snapshot_data_file.TakePlatformFile());
352 } 352 }
353 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); 353 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
354 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); 354 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
355 #endif // V8_USE_EXTERNAL_STARTUP_DATA 355 #endif // V8_USE_EXTERNAL_STARTUP_DATA
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 ShellBrowserContext* 422 ShellBrowserContext*
423 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( 423 ShellContentBrowserClient::ShellBrowserContextForBrowserContext(
424 BrowserContext* content_browser_context) { 424 BrowserContext* content_browser_context) {
425 if (content_browser_context == browser_context()) 425 if (content_browser_context == browser_context())
426 return browser_context(); 426 return browser_context();
427 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); 427 DCHECK_EQ(content_browser_context, off_the_record_browser_context());
428 return off_the_record_browser_context(); 428 return off_the_record_browser_context();
429 } 429 }
430 430
431 } // namespace content 431 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/DEPS ('k') | content/test/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698