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

Side by Side Diff: gin/v8_initializer.cc

Issue 1541743002: Switch to standard integer types in gin/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/v8_initializer.h ('k') | gin/v8_isolate_memory_dump_provider.h » ('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 "base/basictypes.h" 7 #include <stddef.h>
8 #include <stdint.h>
9
8 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
9 #include "base/files/file.h" 11 #include "base/files/file.h"
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
11 #include "base/files/memory_mapped_file.h" 13 #include "base/files/memory_mapped_file.h"
12 #include "base/logging.h" 14 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
14 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
15 #include "base/rand_util.h" 17 #include "base/rand_util.h"
16 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
17 #include "base/threading/platform_thread.h" 19 #include "base/threading/platform_thread.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 #endif 281 #endif
280 &g_mapped_natives); 282 &g_mapped_natives);
281 if (result != V8_LOAD_SUCCESS) { 283 if (result != V8_LOAD_SUCCESS) {
282 LOG(FATAL) << "Couldn't mmap v8 natives data file, status code is " 284 LOG(FATAL) << "Couldn't mmap v8 natives data file, status code is "
283 << static_cast<int>(result); 285 << static_cast<int>(result);
284 } 286 }
285 } 287 }
286 288
287 // static 289 // static
288 void V8Initializer::LoadV8SnapshotFromFD(base::PlatformFile snapshot_pf, 290 void V8Initializer::LoadV8SnapshotFromFD(base::PlatformFile snapshot_pf,
289 int64 snapshot_offset, 291 int64_t snapshot_offset,
290 int64 snapshot_size) { 292 int64_t snapshot_size) {
291 if (g_mapped_snapshot) 293 if (g_mapped_snapshot)
292 return; 294 return;
293 295
294 if (snapshot_pf == kInvalidPlatformFile) 296 if (snapshot_pf == kInvalidPlatformFile)
295 return; 297 return;
296 298
297 base::MemoryMappedFile::Region snapshot_region = 299 base::MemoryMappedFile::Region snapshot_region =
298 base::MemoryMappedFile::Region::kWholeFile; 300 base::MemoryMappedFile::Region::kWholeFile;
299 if (snapshot_size != 0 || snapshot_offset != 0) { 301 if (snapshot_size != 0 || snapshot_offset != 0) {
300 snapshot_region.offset = snapshot_offset; 302 snapshot_region.offset = snapshot_offset;
(...skipping 10 matching lines...) Expand all
311 if (result == V8_LOAD_SUCCESS) { 313 if (result == V8_LOAD_SUCCESS) {
312 g_snapshot_pf = snapshot_pf; 314 g_snapshot_pf = snapshot_pf;
313 g_snapshot_region = snapshot_region; 315 g_snapshot_region = snapshot_region;
314 } 316 }
315 UMA_HISTOGRAM_ENUMERATION("V8.Initializer.LoadV8Snapshot.Result", result, 317 UMA_HISTOGRAM_ENUMERATION("V8.Initializer.LoadV8Snapshot.Result", result,
316 V8_LOAD_MAX_VALUE); 318 V8_LOAD_MAX_VALUE);
317 } 319 }
318 320
319 // static 321 // static
320 void V8Initializer::LoadV8NativesFromFD(base::PlatformFile natives_pf, 322 void V8Initializer::LoadV8NativesFromFD(base::PlatformFile natives_pf,
321 int64 natives_offset, 323 int64_t natives_offset,
322 int64 natives_size) { 324 int64_t natives_size) {
323 if (g_mapped_natives) 325 if (g_mapped_natives)
324 return; 326 return;
325 327
326 CHECK_NE(natives_pf, kInvalidPlatformFile); 328 CHECK_NE(natives_pf, kInvalidPlatformFile);
327 329
328 base::MemoryMappedFile::Region natives_region = 330 base::MemoryMappedFile::Region natives_region =
329 base::MemoryMappedFile::Region::kWholeFile; 331 base::MemoryMappedFile::Region::kWholeFile;
330 if (natives_size != 0 || natives_offset != 0) { 332 if (natives_size != 0 || natives_offset != 0) {
331 natives_region.offset = natives_offset; 333 natives_region.offset = natives_offset;
332 natives_region.size = natives_size; 334 natives_region.size = natives_size;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 *snapshot_data_out = 417 *snapshot_data_out =
416 reinterpret_cast<const char*>(g_mapped_snapshot->data()); 418 reinterpret_cast<const char*>(g_mapped_snapshot->data());
417 *snapshot_size_out = static_cast<int>(g_mapped_snapshot->length()); 419 *snapshot_size_out = static_cast<int>(g_mapped_snapshot->length());
418 } else { 420 } else {
419 *snapshot_data_out = NULL; 421 *snapshot_data_out = NULL;
420 *snapshot_size_out = 0; 422 *snapshot_size_out = 0;
421 } 423 }
422 } 424 }
423 425
424 } // namespace gin 426 } // namespace gin
OLDNEW
« no previous file with comments | « gin/v8_initializer.h ('k') | gin/v8_isolate_memory_dump_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698