Chromium Code Reviews| Index: src/api.cc |
| =================================================================== |
| --- src/api.cc (revision 9266) |
| +++ src/api.cc (working copy) |
| @@ -501,9 +501,12 @@ |
| Extension::Extension(const char* name, |
| const char* source, |
| int dep_count, |
| - const char** deps) |
| + const char** deps, |
| + int source_length) |
| : name_(name), |
| - source_(source), |
| + source_length_(source_length >= 0 ? |
|
Aaron Boodman
2011/09/14 20:33:18
Nested ternary operators are hard to read and this
miket_OOO
2011/09/14 20:47:16
You're right; it works great as-is but it's fragil
|
| + source_length : (source ? strlen(source) : 0)), |
| + source_(source, source_length_), |
| dep_count_(dep_count), |
| deps_(deps), |
| auto_enable_(false) { } |
| @@ -3799,10 +3802,11 @@ |
| void v8::String::VerifyExternalStringResource( |
| v8::String::ExternalStringResource* value) const { |
| i::Handle<i::String> str = Utils::OpenHandle(this); |
| - v8::String::ExternalStringResource* expected; |
| + const v8::String::ExternalStringResource* expected; |
| if (i::StringShape(*str).IsExternalTwoByte()) { |
| - void* resource = i::Handle<i::ExternalTwoByteString>::cast(str)->resource(); |
| - expected = reinterpret_cast<ExternalStringResource*>(resource); |
| + const void* resource = |
| + i::Handle<i::ExternalTwoByteString>::cast(str)->resource(); |
| + expected = reinterpret_cast<const ExternalStringResource*>(resource); |
| } else { |
| expected = NULL; |
| } |
| @@ -3810,7 +3814,7 @@ |
| } |
| -v8::String::ExternalAsciiStringResource* |
| +const v8::String::ExternalAsciiStringResource* |
| v8::String::GetExternalAsciiStringResource() const { |
| i::Handle<i::String> str = Utils::OpenHandle(this); |
| if (IsDeadCheck(str->GetIsolate(), |
| @@ -3818,8 +3822,9 @@ |
| return NULL; |
| } |
| if (i::StringShape(*str).IsExternalAscii()) { |
| - void* resource = i::Handle<i::ExternalAsciiString>::cast(str)->resource(); |
| - return reinterpret_cast<ExternalAsciiStringResource*>(resource); |
| + const void* resource = |
| + i::Handle<i::ExternalAsciiString>::cast(str)->resource(); |
| + return reinterpret_cast<const ExternalAsciiStringResource*>(resource); |
| } else { |
| return NULL; |
| } |