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

Unified Diff: src/d8.h

Issue 9283015: Introduce readbinary function in d8 to read binary files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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 | src/d8.cc » ('j') | src/d8.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.h
diff --git a/src/d8.h b/src/d8.h
index 60a8c1bf760b722b880fdea52e73d3589615996a..7f3e31bfb0d2e96365d95b26ec8ab74e2b12c3ed 100644
--- a/src/d8.h
+++ b/src/d8.h
@@ -195,6 +195,27 @@ class SourceGroup {
};
+class BinaryResource : public v8::String::ExternalAsciiStringResource {
+ public:
+ explicit BinaryResource(const char* string, int length)
Jakob Kummerow 2012/01/24 11:30:20 nit: "explicit" is unnecessary.
+ : data_(string),
+ length_(length) { }
+
+ ~BinaryResource() {
+ delete data_;
Jakob Kummerow 2012/01/24 11:30:20 shouldn't this be "delete[] data_"?
+ data_ = NULL;
+ length_ = 0;
+ }
+
+ virtual const char* data() const { return data_; }
+ virtual size_t length() const { return length_; }
+
+ private:
+ const char* data_;
+ size_t length_;
+};
+
+
class ShellOptions {
public:
ShellOptions() :
@@ -286,6 +307,7 @@ class Shell : public i::AllStatic {
static Handle<Value> EnableProfiler(const Arguments& args);
static Handle<Value> DisableProfiler(const Arguments& args);
static Handle<Value> Read(const Arguments& args);
+ static Handle<Value> ReadBinary(const Arguments& args);
static Handle<String> ReadFromStdin();
static Handle<Value> ReadLine(const Arguments& args) {
return ReadFromStdin();
« no previous file with comments | « no previous file | src/d8.cc » ('j') | src/d8.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698