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

Unified Diff: runtime/bin/dartutils.h

Issue 12438033: Write the magic number 0xf5f5dcdc into a script snapshot file and use this to distinguish whether a… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dartutils.h
===================================================================
--- runtime/bin/dartutils.h (revision 20286)
+++ runtime/bin/dartutils.h (working copy)
@@ -10,6 +10,9 @@
#include "include/dart_api.h"
#include "platform/globals.h"
+// Forward declarations.
+class File;
+
/* Handles error handles returned from Dart API functions. If a value
* is an error, uses Dart_PropagateError to throw it to the enclosing
* Dart activation. Otherwise, returns the original handle.
@@ -157,6 +160,16 @@
Dart_Handle url,
Dart_Handle builtin_lib);
+ // Sniffs the specified text_buffer to see if it contains the magic number
+ // representing a script snapshot. If the text_buffer is a script snapshot
+ // the return value is an updated pointer to the text_buffer pointing past
+ // the magic number value.
+ static const uint8_t* SniffForMagicNumber(const uint8_t* text_buffer,
+ bool* is_snapshot);
+
+ // Write a magic number to indicate a script snapshot file.
+ static void WriteMagicNumber(File* file);
+
// Global state that stores the original working directory..
static const char* original_working_directory;
@@ -175,6 +188,8 @@
static const char* kIdFieldName;
+ static uint8_t magic_number[];
+
private:
static const char* GetCanonicalPath(const char* reference_dir,
const char* filename);
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698