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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp

Issue 2723973002: Make V8Binding helpers return LocalFrame/LocalDOMWindow as appropriate (Closed)
Patch Set: . Created 3 years, 9 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
Index: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
index 5e5b1bec44996c9417eab0440084932643e50d56..33e3c667246f5a944890517602751b2fb81432bc 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
@@ -717,21 +717,22 @@ DOMWindow* toDOMWindow(v8::Isolate* isolate, v8::Local<v8::Value> value) {
return 0;
}
-DOMWindow* toDOMWindow(v8::Local<v8::Context> context) {
+LocalDOMWindow* toLocalDOMWindow(v8::Local<v8::Context> context) {
if (context.IsEmpty())
return 0;
- return toDOMWindow(context->GetIsolate(), context->Global());
+ return toLocalDOMWindow(
+ toDOMWindow(context->GetIsolate(), context->Global()));
}
LocalDOMWindow* enteredDOMWindow(v8::Isolate* isolate) {
LocalDOMWindow* window =
- toLocalDOMWindow(toDOMWindow(isolate->GetEnteredOrMicrotaskContext()));
+ toLocalDOMWindow(isolate->GetEnteredOrMicrotaskContext());
DCHECK(window);
return window;
}
LocalDOMWindow* currentDOMWindow(v8::Isolate* isolate) {
- return toLocalDOMWindow(toDOMWindow(isolate->GetCurrentContext()));
+ return toLocalDOMWindow(isolate->GetCurrentContext());
}
ExecutionContext* toExecutionContext(v8::Local<v8::Context> context) {
@@ -760,8 +761,8 @@ ExecutionContext* currentExecutionContext(v8::Isolate* isolate) {
return toExecutionContext(isolate->GetCurrentContext());
}
-Frame* toFrameIfNotDetached(v8::Local<v8::Context> context) {
- DOMWindow* window = toDOMWindow(context);
+LocalFrame* toLocalFrameIfNotDetached(v8::Local<v8::Context> context) {
+ LocalDOMWindow* window = toLocalDOMWindow(context);
if (window && window->isCurrentlyDisplayedInFrame())
return window->frame();
// We return 0 here because |context| is detached from the Frame. If we
@@ -801,7 +802,7 @@ v8::Local<v8::Context> toV8Context(ExecutionContext* context,
return v8::Local<v8::Context>();
}
-v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) {
+v8::Local<v8::Context> toV8Context(LocalFrame* frame, DOMWrapperWorld& world) {
if (!frame)
return v8::Local<v8::Context>();
v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world);
@@ -809,13 +810,13 @@ v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) {
return v8::Local<v8::Context>();
ScriptState* scriptState = ScriptState::from(context);
if (scriptState->contextIsValid()) {
- ASSERT(toFrameIfNotDetached(context) == frame);
+ DCHECK_EQ(frame, toLocalFrameIfNotDetached(context));
return scriptState->context();
}
return v8::Local<v8::Context>();
}
-v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame,
+v8::Local<v8::Context> toV8ContextEvenIfDetached(LocalFrame* frame,
DOMWrapperWorld& world) {
ASSERT(frame);
return frame->windowProxy(world)->contextIfInitialized();

Powered by Google App Engine
This is Rietveld 408576698