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

Side by Side Diff: gin/isolate_holder.cc

Issue 1019483002: Add support to extension_shell and ash_shell to use external V8 snapshot files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove gyp changes Created 5 years, 9 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
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/public/isolate_holder.h" 5 #include "gin/public/isolate_holder.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 base::MemoryMappedFile::Region snapshot_region = 187 base::MemoryMappedFile::Region snapshot_region =
188 base::MemoryMappedFile::Region::kWholeFile; 188 base::MemoryMappedFile::Region::kWholeFile;
189 if (natives_size != 0 || natives_offset != 0) { 189 if (natives_size != 0 || natives_offset != 0) {
190 snapshot_region = 190 snapshot_region =
191 base::MemoryMappedFile::Region(snapshot_offset, snapshot_size); 191 base::MemoryMappedFile::Region(snapshot_offset, snapshot_size);
192 } 192 }
193 193
194 return MapV8Files( 194 return MapV8Files(
195 NULL, NULL, natives_fd, snapshot_fd, natives_region, snapshot_region); 195 NULL, NULL, natives_fd, snapshot_fd, natives_region, snapshot_region);
196 } 196 }
197
198 // static
199 bool IsolateHolder::MapV8FilesForChildProcesses(int* natives_fd_out,
James Cook 2015/03/18 23:20:06 This function always returns true. Does it need a
rmcilroy 2015/03/19 14:41:39 Yes, this is probably better. Also changed the if'
200 int* snapshot_fd_out) {
201 base::FilePath data_path;
202 PathService::Get(kV8SnapshotBasePathKey, &data_path);
203 DCHECK(!data_path.empty());
204
205 int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
206 base::FilePath natives_data_path = data_path.AppendASCII(kNativesFileName);
207 base::FilePath snapshot_data_path = data_path.AppendASCII(kSnapshotFileName);
208 base::File natives_data_file(natives_data_path, file_flags);
209 base::File snapshot_data_file(snapshot_data_path, file_flags);
210 DCHECK(natives_data_file.IsValid());
211 DCHECK(snapshot_data_file.IsValid());
212 *natives_fd_out = natives_data_file.TakePlatformFile();
213 *snapshot_fd_out = snapshot_data_file.TakePlatformFile();
214 return true;
215 }
197 #endif // V8_USE_EXTERNAL_STARTUP_DATA 216 #endif // V8_USE_EXTERNAL_STARTUP_DATA
198 217
199 //static 218 //static
200 void IsolateHolder::GetV8ExternalSnapshotData(const char** natives_data_out, 219 void IsolateHolder::GetV8ExternalSnapshotData(const char** natives_data_out,
201 int* natives_size_out, 220 int* natives_size_out,
202 const char** snapshot_data_out, 221 const char** snapshot_data_out,
203 int* snapshot_size_out) { 222 int* snapshot_size_out) {
204 if (!g_mapped_natives || !g_mapped_snapshot) { 223 if (!g_mapped_natives || !g_mapped_snapshot) {
205 *natives_data_out = *snapshot_data_out = NULL; 224 *natives_data_out = *snapshot_data_out = NULL;
206 *natives_size_out = *snapshot_size_out = 0; 225 *natives_size_out = *snapshot_size_out = 0;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 base::MessageLoop::current()->AddTaskObserver(task_observer_.get()); 310 base::MessageLoop::current()->AddTaskObserver(task_observer_.get());
292 } 311 }
293 312
294 void IsolateHolder::RemoveRunMicrotasksObserver() { 313 void IsolateHolder::RemoveRunMicrotasksObserver() {
295 DCHECK(task_observer_.get()); 314 DCHECK(task_observer_.get());
296 base::MessageLoop::current()->RemoveTaskObserver(task_observer_.get()); 315 base::MessageLoop::current()->RemoveTaskObserver(task_observer_.get());
297 task_observer_.reset(); 316 task_observer_.reset();
298 } 317 }
299 318
300 } // namespace gin 319 } // namespace gin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698