OLD | NEW |
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 "base/basictypes.h" |
8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #endif | 46 #endif |
47 | 47 |
48 // File handles intentionally never closed. Not using File here because its | 48 // File handles intentionally never closed. Not using File here because its |
49 // Windows implementation guards against two instances owning the same | 49 // Windows implementation guards against two instances owning the same |
50 // PlatformFile (which we allow since we know it is never freed). | 50 // PlatformFile (which we allow since we know it is never freed). |
51 base::PlatformFile g_natives_pf = kInvalidPlatformFile; | 51 base::PlatformFile g_natives_pf = kInvalidPlatformFile; |
52 base::PlatformFile g_snapshot_pf = kInvalidPlatformFile; | 52 base::PlatformFile g_snapshot_pf = kInvalidPlatformFile; |
53 base::MemoryMappedFile::Region g_natives_region; | 53 base::MemoryMappedFile::Region g_natives_region; |
54 base::MemoryMappedFile::Region g_snapshot_region; | 54 base::MemoryMappedFile::Region g_snapshot_region; |
55 | 55 |
| 56 #if defined(OS_ANDROID) |
| 57 #ifdef __LP64__ |
| 58 const char kNativesFileName[] = "natives_blob_64.bin"; |
| 59 const char kSnapshotFileName[] = "snapshot_blob_64.bin"; |
| 60 #else |
| 61 const char kNativesFileName[] = "natives_blob_32.bin"; |
| 62 const char kSnapshotFileName[] = "snapshot_blob_32.bin"; |
| 63 #endif // __LP64__ |
| 64 |
| 65 #else // defined(OS_ANDROID) |
56 const char kNativesFileName[] = "natives_blob.bin"; | 66 const char kNativesFileName[] = "natives_blob.bin"; |
57 const char kSnapshotFileName[] = "snapshot_blob.bin"; | 67 const char kSnapshotFileName[] = "snapshot_blob.bin"; |
| 68 #endif // defined(OS_ANDROID) |
58 | 69 |
59 void GetV8FilePath(const char* file_name, base::FilePath* path_out) { | 70 void GetV8FilePath(const char* file_name, base::FilePath* path_out) { |
60 #if !defined(OS_MACOSX) | 71 #if !defined(OS_MACOSX) |
61 base::FilePath data_path; | 72 base::FilePath data_path; |
62 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
63 // This is the path within the .apk. | 74 // This is the path within the .apk. |
64 data_path = base::FilePath(FILE_PATH_LITERAL("assets")); | 75 data_path = base::FilePath(FILE_PATH_LITERAL("assets")); |
65 #elif defined(OS_POSIX) | 76 #elif defined(OS_POSIX) |
66 PathService::Get(base::DIR_EXE, &data_path); | 77 PathService::Get(base::DIR_EXE, &data_path); |
67 #elif defined(OS_WIN) | 78 #elif defined(OS_WIN) |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 *snapshot_data_out = | 410 *snapshot_data_out = |
400 reinterpret_cast<const char*>(g_mapped_snapshot->data()); | 411 reinterpret_cast<const char*>(g_mapped_snapshot->data()); |
401 *snapshot_size_out = static_cast<int>(g_mapped_snapshot->length()); | 412 *snapshot_size_out = static_cast<int>(g_mapped_snapshot->length()); |
402 } else { | 413 } else { |
403 *snapshot_data_out = NULL; | 414 *snapshot_data_out = NULL; |
404 *snapshot_size_out = 0; | 415 *snapshot_size_out = 0; |
405 } | 416 } |
406 } | 417 } |
407 | 418 |
408 } // namespace gin | 419 } // namespace gin |
OLD | NEW |