Ken Rockot | 8dda8888 | 2019-12-04 05:56:22 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "content/browser/v8_snapshot_files.h" |
| 6 | |
| 7 | #include "build/build_config.h" |
| 8 | #include "content/public/common/content_descriptor_keys.h" |
| 9 | |
| 10 | namespace content { |
| 11 | |
| 12 | std::map<std::string, base::FilePath> GetV8SnapshotFilesToPreload() { |
| 13 | #if defined(OS_LINUX) |
| 14 | #if defined(USE_V8_CONTEXT_SNAPSHOT) |
| 15 | return {{kV8ContextSnapshotDataDescriptor, |
| 16 | base::FilePath(FILE_PATH_LITERAL("v8_context_snapshot.bin"))}}; |
| 17 | #else |
| 18 | return {{kV8SnapshotDataDescriptor, |
| 19 | base::FilePath(FILE_PATH_LITERAL("snapshot_blob.bin"))}}; |
| 20 | #endif |
| 21 | #elif defined(OS_ANDROID) |
| 22 | #if defined(USE_V8_CONTEXT_SNAPSHOT) |
Ken Rockot | 8dda8888 | 2019-12-04 05:56:22 | [diff] [blame] | 23 | return { |
| 24 | {kV8Snapshot64DataDescriptor, |
Jinsong Fan | bac4d2f | 2019-12-14 00:20:58 | [diff] [blame] | 25 | base::FilePath(FILE_PATH_LITERAL("assets/v8_context_snapshot_64.bin"))}, |
Ken Rockot | 8dda8888 | 2019-12-04 05:56:22 | [diff] [blame] | 26 | {kV8Snapshot32DataDescriptor, |
| 27 | base::FilePath(FILE_PATH_LITERAL("assets/v8_context_snapshot_32.bin"))}}; |
Ken Rockot | 8dda8888 | 2019-12-04 05:56:22 | [diff] [blame] | 28 | #else |
Ken Rockot | 8dda8888 | 2019-12-04 05:56:22 | [diff] [blame] | 29 | return {{kV8Snapshot64DataDescriptor, |
Jinsong Fan | bac4d2f | 2019-12-14 00:20:58 | [diff] [blame] | 30 | base::FilePath(FILE_PATH_LITERAL("assets/snapshot_blob_64.bin"))}, |
| 31 | {kV8Snapshot32DataDescriptor, |
Ken Rockot | 8dda8888 | 2019-12-04 05:56:22 | [diff] [blame] | 32 | base::FilePath(FILE_PATH_LITERAL("assets/snapshot_blob_32.bin"))}}; |
| 33 | #endif |
Ken Rockot | 8dda8888 | 2019-12-04 05:56:22 | [diff] [blame] | 34 | #else |
| 35 | return {}; |
| 36 | #endif |
| 37 | } |
| 38 | |
| 39 | } // namespace content |