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

Side by Side Diff: src/startup-data-util.h

Issue 913703002: Fix cctest + unittest to work with an external snapshot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 10 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 | « src/d8.gyp ('k') | src/startup-data-util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project 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
6 #ifndef V8_STARTUP_DATA_UTIL_H_
7 #define V8_STARTUP_DATA_UTIL_H_
8
9 #include "include/v8.h"
10
11 namespace v8 {
12
13 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
14 // Helper class to load the startup data files from disk.
15 //
16 // This is meant as a convenience for stand-alone binaries like d8, cctest,
17 // unittest. A V8 embedder would likely either handle startup data on their
18 // own or just disable the feature if they don't want to handle it at all,
19 // while tools like cctest need to work in either configuration. Hence this is
20 // not meant for inclusion in the general v8 library.
21 class StartupDataHandler {
22 public:
23 // Load startup data, and call the v8::V8::Set*DataBlob API functions.
24 //
25 // natives_blob and snapshot_blob will be loaded realitive to exec_path,
26 // which would usually be the equivalent of argv[0].
27 StartupDataHandler(const char* exec_path, const char* natives_blob,
28 const char* snapshot_blob);
29 ~StartupDataHandler();
30
31 private:
32 static char* RelativePath(char** buffer, const char* exec_path,
33 const char* name);
34
35 void LoadFromFiles(const char* natives_blob, const char* snapshot_blob);
36
37 void Load(const char* blob_file, v8::StartupData* startup_data,
38 void (*setter_fn)(v8::StartupData*));
39
40 v8::StartupData natives_;
41 v8::StartupData snapshot_;
42
43 // Disallow copy & assign.
44 StartupDataHandler(const StartupDataHandler& other);
45 void operator=(const StartupDataHandler& other);
46 };
47 #endif // V8_USE_EXTERNAL_STARTUP_DATA
48
49 } // namespace v8
50
51 #endif // V8_STARTUP_DATA_UTIL_H_
OLDNEW
« no previous file with comments | « src/d8.gyp ('k') | src/startup-data-util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698