| Index: third_party/WebKit/Source/bindings/core/v8/V8StringResource.h
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h
|
| index 9661f9c34ec7729322121ff589f585dd1fd49623..c01715d4bfc46943297510069dd6b88dbb98bf0b 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h
|
| @@ -187,32 +187,21 @@ class V8StringResource {
|
|
|
| void operator=(std::nullptr_t) { setString(String()); }
|
|
|
| - bool prepare() {
|
| + bool prepare() { // DEPRECATED
|
| if (prepareFast())
|
| return true;
|
|
|
| - // TODO(bashi): Pass an isolate to this function and remove
|
| - // v8::Isolate::GetCurrent().
|
| return m_v8Object->ToString(v8::Isolate::GetCurrent()->GetCurrentContext())
|
| .ToLocal(&m_v8Object);
|
| }
|
|
|
| - bool prepare(ExceptionState& exceptionState) {
|
| - if (prepareFast())
|
| - return true;
|
| + bool prepare(v8::Isolate* isolate, ExceptionState& exceptionState) {
|
| + return prepareFast() || prepareSlow(isolate, exceptionState);
|
| + }
|
|
|
| - // TODO(bashi): Pass an isolate to this function and remove
|
| - // v8::Isolate::GetCurrent().
|
| - v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| - v8::TryCatch block(isolate);
|
| - // Handle the case where an exception is thrown as part of invoking toString
|
| - // on the object.
|
| - if (!m_v8Object->ToString(isolate->GetCurrentContext())
|
| - .ToLocal(&m_v8Object)) {
|
| - exceptionState.rethrowV8Exception(block.Exception());
|
| - return false;
|
| - }
|
| - return true;
|
| + bool prepare(ExceptionState& exceptionState) { // DEPRECATED
|
| + return prepareFast() ||
|
| + prepareSlow(v8::Isolate::GetCurrent(), exceptionState);
|
| }
|
|
|
| operator String() const { return toString<String>(); }
|
| @@ -240,6 +229,16 @@ class V8StringResource {
|
| return false;
|
| }
|
|
|
| + bool prepareSlow(v8::Isolate* isolate, ExceptionState& exceptionState) {
|
| + v8::TryCatch tryCatch(isolate);
|
| + if (!m_v8Object->ToString(isolate->GetCurrentContext())
|
| + .ToLocal(&m_v8Object)) {
|
| + exceptionState.rethrowV8Exception(tryCatch.Exception());
|
| + return false;
|
| + }
|
| + return true;
|
| + }
|
| +
|
| bool isValid() const;
|
| String fallbackString() const;
|
|
|
|
|