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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/d8.cc » ('j') | src/d8.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 void ExitShell(int exit_code); 189 void ExitShell(int exit_code);
190 Handle<String> ReadFile(const char* name); 190 Handle<String> ReadFile(const char* name);
191 191
192 const char** argv_; 192 const char** argv_;
193 int begin_offset_; 193 int begin_offset_;
194 int end_offset_; 194 int end_offset_;
195 }; 195 };
196 196
197 197
198 class BinaryResource : public v8::String::ExternalAsciiStringResource {
199 public:
200 explicit BinaryResource(const char* string, int length)
Jakob Kummerow 2012/01/24 11:30:20 nit: "explicit" is unnecessary.
201 : data_(string),
202 length_(length) { }
203
204 ~BinaryResource() {
205 delete data_;
Jakob Kummerow 2012/01/24 11:30:20 shouldn't this be "delete[] data_"?
206 data_ = NULL;
207 length_ = 0;
208 }
209
210 virtual const char* data() const { return data_; }
211 virtual size_t length() const { return length_; }
212
213 private:
214 const char* data_;
215 size_t length_;
216 };
217
218
198 class ShellOptions { 219 class ShellOptions {
199 public: 220 public:
200 ShellOptions() : 221 ShellOptions() :
201 #ifndef V8_SHARED 222 #ifndef V8_SHARED
202 use_preemption(true), 223 use_preemption(true),
203 preemption_interval(10), 224 preemption_interval(10),
204 num_parallel_files(0), 225 num_parallel_files(0),
205 parallel_files(NULL), 226 parallel_files(NULL),
206 #endif // V8_SHARED 227 #endif // V8_SHARED
207 script_executed(false), 228 script_executed(false),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 #endif 300 #endif
280 301
281 static Handle<Value> Print(const Arguments& args); 302 static Handle<Value> Print(const Arguments& args);
282 static Handle<Value> Write(const Arguments& args); 303 static Handle<Value> Write(const Arguments& args);
283 static Handle<Value> Yield(const Arguments& args); 304 static Handle<Value> Yield(const Arguments& args);
284 static Handle<Value> Quit(const Arguments& args); 305 static Handle<Value> Quit(const Arguments& args);
285 static Handle<Value> Version(const Arguments& args); 306 static Handle<Value> Version(const Arguments& args);
286 static Handle<Value> EnableProfiler(const Arguments& args); 307 static Handle<Value> EnableProfiler(const Arguments& args);
287 static Handle<Value> DisableProfiler(const Arguments& args); 308 static Handle<Value> DisableProfiler(const Arguments& args);
288 static Handle<Value> Read(const Arguments& args); 309 static Handle<Value> Read(const Arguments& args);
310 static Handle<Value> ReadBinary(const Arguments& args);
289 static Handle<String> ReadFromStdin(); 311 static Handle<String> ReadFromStdin();
290 static Handle<Value> ReadLine(const Arguments& args) { 312 static Handle<Value> ReadLine(const Arguments& args) {
291 return ReadFromStdin(); 313 return ReadFromStdin();
292 } 314 }
293 static Handle<Value> Load(const Arguments& args); 315 static Handle<Value> Load(const Arguments& args);
294 static Handle<Value> ArrayBuffer(const Arguments& args); 316 static Handle<Value> ArrayBuffer(const Arguments& args);
295 static Handle<Value> Int8Array(const Arguments& args); 317 static Handle<Value> Int8Array(const Arguments& args);
296 static Handle<Value> Uint8Array(const Arguments& args); 318 static Handle<Value> Uint8Array(const Arguments& args);
297 static Handle<Value> Int16Array(const Arguments& args); 319 static Handle<Value> Int16Array(const Arguments& args);
298 static Handle<Value> Uint16Array(const Arguments& args); 320 static Handle<Value> Uint16Array(const Arguments& args);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 ExternalArrayType type, 387 ExternalArrayType type,
366 size_t element_size); 388 size_t element_size);
367 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data); 389 static void ExternalArrayWeakCallback(Persistent<Value> object, void* data);
368 }; 390 };
369 391
370 392
371 } // namespace v8 393 } // namespace v8
372 394
373 395
374 #endif // V8_D8_H_ 396 #endif // V8_D8_H_
OLDNEW
« 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