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

Side by Side Diff: gin/v8_initializer.cc

Issue 1848423002: Convert //gin to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « gin/test/v8_test.h ('k') | gin/v8_isolate_memory_dump_provider_unittest.cc » ('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 "gin/v8_initializer.h" 5 #include "gin/v8_initializer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
11
10 #include "base/debug/alias.h" 12 #include "base/debug/alias.h"
11 #include "base/files/file.h" 13 #include "base/files/file.h"
12 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
13 #include "base/files/memory_mapped_file.h" 15 #include "base/files/memory_mapped_file.h"
14 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
15 #include "base/logging.h" 17 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
18 #include "base/rand_util.h" 19 #include "base/rand_util.h"
19 #include "base/strings/sys_string_conversions.h" 20 #include "base/strings/sys_string_conversions.h"
20 #include "base/threading/platform_thread.h" 21 #include "base/threading/platform_thread.h"
21 #include "base/time/time.h" 22 #include "base/time/time.h"
22 #include "crypto/sha2.h" 23 #include "crypto/sha2.h"
23 24
24 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 25 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
25 #if defined(OS_ANDROID) 26 #if defined(OS_ANDROID)
26 #include "base/android/apk_assets.h" 27 #include "base/android/apk_assets.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 base::SysUTF8ToCFStringRef(file_name)); 105 base::SysUTF8ToCFStringRef(file_name));
105 *path_out = base::mac::PathForFrameworkBundleResource(natives_file_name); 106 *path_out = base::mac::PathForFrameworkBundleResource(natives_file_name);
106 #endif // !defined(OS_MACOSX) 107 #endif // !defined(OS_MACOSX)
107 DCHECK(!path_out->empty()); 108 DCHECK(!path_out->empty());
108 } 109 }
109 110
110 static bool MapV8File(base::PlatformFile platform_file, 111 static bool MapV8File(base::PlatformFile platform_file,
111 base::MemoryMappedFile::Region region, 112 base::MemoryMappedFile::Region region,
112 base::MemoryMappedFile** mmapped_file_out) { 113 base::MemoryMappedFile** mmapped_file_out) {
113 DCHECK(*mmapped_file_out == NULL); 114 DCHECK(*mmapped_file_out == NULL);
114 scoped_ptr<base::MemoryMappedFile> mmapped_file(new base::MemoryMappedFile()); 115 std::unique_ptr<base::MemoryMappedFile> mmapped_file(
116 new base::MemoryMappedFile());
115 if (mmapped_file->Initialize(base::File(platform_file), region)) { 117 if (mmapped_file->Initialize(base::File(platform_file), region)) {
116 *mmapped_file_out = mmapped_file.release(); 118 *mmapped_file_out = mmapped_file.release();
117 return true; 119 return true;
118 } 120 }
119 return false; 121 return false;
120 } 122 }
121 123
122 base::PlatformFile OpenV8File(const char* file_name, 124 base::PlatformFile OpenV8File(const char* file_name,
123 base::MemoryMappedFile::Region* region_out) { 125 base::MemoryMappedFile::Region* region_out) {
124 // Re-try logic here is motivated by http://crbug.com/479537 126 // Re-try logic here is motivated by http://crbug.com/479537
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 473
472 // static 474 // static
473 base::FilePath V8Initializer::GetSnapshotFilePath(bool abi_32_bit) { 475 base::FilePath V8Initializer::GetSnapshotFilePath(bool abi_32_bit) {
474 base::FilePath path; 476 base::FilePath path;
475 GetV8FilePath(abi_32_bit ? kSnapshotFileName32 : kSnapshotFileName64, &path); 477 GetV8FilePath(abi_32_bit ? kSnapshotFileName32 : kSnapshotFileName64, &path);
476 return path; 478 return path;
477 } 479 }
478 #endif // defined(OS_ANDROID) 480 #endif // defined(OS_ANDROID)
479 481
480 } // namespace gin 482 } // namespace gin
OLDNEW
« no previous file with comments | « gin/test/v8_test.h ('k') | gin/v8_isolate_memory_dump_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698