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

Unified Diff: include/v8.h

Issue 7889046: Add an optional source length field to the Extension constructor. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 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/api.cc » ('j') | src/api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
===================================================================
--- include/v8.h (revision 9266)
+++ include/v8.h (working copy)
@@ -1168,7 +1168,8 @@
* Get the ExternalAsciiStringResource for an external ascii string.
* Returns NULL if IsExternalAscii() doesn't return true.
*/
- V8EXPORT ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
+ V8EXPORT const ExternalAsciiStringResource*GetExternalAsciiStringResource()
Aaron Boodman 2011/09/14 20:33:18 Nit: Put the space back after the *.
miket_OOO 2011/09/14 20:47:16 Whoops! Thanks.
+ const;
static inline String* Cast(v8::Value* obj);
@@ -2448,24 +2449,41 @@
// --- Extensions ---
+class ExternalAsciiStringResourceImpl
+ : public String::ExternalAsciiStringResource {
+ public:
+ ExternalAsciiStringResourceImpl() : data_(0), length_(0) {};
fschneider 2011/09/19 07:58:57 No ; at the end?
miket_OOO 2011/09/19 17:39:21 Fixed (et seq.). Thanks. Still a bit rusty on C++
+ ExternalAsciiStringResourceImpl(const char *data, size_t length)
Aaron Boodman 2011/09/14 20:33:18 In chrome, the * goes next to the type.
miket_OOO 2011/09/14 20:47:16 I'm trying to untrain myself. Fixed; thanks.
+ : data_(data), length_(length) {};
fschneider 2011/09/19 07:58:57 ; at the end should not be necessary
+ const char *data() const { return data_; }
+ size_t length() const { return length_; }
+ private:
fschneider 2011/09/19 07:58:57 Newline before private:
miket_OOO 2011/09/19 17:39:21 Fixed.
+ const char *data_;
+ size_t length_;
+};
/**
* Ignore
*/
class V8EXPORT Extension { // NOLINT
public:
+ // Note that the strings passed into this constructor must live as long
+ // as the Extension itself.
Extension(const char* name,
const char* source = 0,
int dep_count = 0,
- const char** deps = 0);
+ const char** deps = 0,
+ int source_length = -1);
fschneider 2011/09/19 07:58:57 I wish there was a way to reduce the number of opt
miket_OOO 2011/09/19 17:39:21 Agreed. I'd appreciate your opinion on altering vs
virtual ~Extension() { }
virtual v8::Handle<v8::FunctionTemplate>
GetNativeFunction(v8::Handle<v8::String> name) {
return v8::Handle<v8::FunctionTemplate>();
}
- const char* name() { return name_; }
- const char* source() { return source_; }
+ const char* name() const { return name_; }
+ size_t source_length() const { return source_length_; }
+ const String::ExternalAsciiStringResource* source() const {
+ return &source_; }
int dependency_count() { return dep_count_; }
const char** dependencies() { return deps_; }
void set_auto_enable(bool value) { auto_enable_ = value; }
@@ -2473,7 +2491,8 @@
private:
const char* name_;
- const char* source_;
+ size_t source_length_; // expected to initialize before source_
+ ExternalAsciiStringResourceImpl source_;
int dep_count_;
const char** deps_;
bool auto_enable_;
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698