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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp

Issue 2630693002: Make ScriptController inherit LocalWindowProxyManager
Patch Set: rebase Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 void WindowProxy::clearForClose() { 95 void WindowProxy::clearForClose() {
96 disposeContext(DoNotDetachGlobal); 96 disposeContext(DoNotDetachGlobal);
97 } 97 }
98 98
99 void WindowProxy::clearForNavigation() { 99 void WindowProxy::clearForNavigation() {
100 disposeContext(DetachGlobal); 100 disposeContext(DetachGlobal);
101 } 101 }
102 102
103 v8::Local<v8::Object> WindowProxy::globalIfNotDetached() { 103 v8::Local<v8::Object> WindowProxy::globalProxy() {
104 if (m_lifecycle == Lifecycle::ContextInitialized) { 104 if (m_frame->client())
105 DCHECK(m_scriptState->contextIsValid()); 105 initializeIfNeeded();
106 DCHECK(m_globalProxy == m_scriptState->context()->Global()); 106 return m_globalProxy.newLocal(m_isolate);
107 return m_globalProxy.newLocal(m_isolate);
108 }
109 return v8::Local<v8::Object>();
110 } 107 }
111 108
112 v8::Local<v8::Object> WindowProxy::releaseGlobal() { 109 v8::Local<v8::Object> WindowProxy::releaseGlobal() {
113 DCHECK(m_lifecycle != Lifecycle::ContextInitialized); 110 DCHECK(m_lifecycle != Lifecycle::ContextInitialized);
114 // Make sure the global object was detached from the proxy by calling 111 // Make sure the global object was detached from the proxy by calling
115 // clearForNavigation(). 112 // clearForNavigation().
116 if (m_lifecycle == Lifecycle::ContextDetached) 113 if (m_lifecycle == Lifecycle::ContextDetached)
117 ASSERT(m_scriptState->isGlobalObjectDetached()); 114 ASSERT(m_scriptState->isGlobalObjectDetached());
118 115
119 v8::Local<v8::Object> global = m_globalProxy.newLocal(m_isolate); 116 v8::Local<v8::Object> global = m_globalProxy.newLocal(m_isolate);
120 m_globalProxy.clear(); 117 m_globalProxy.clear();
121 return global; 118 return global;
122 } 119 }
123 120
124 void WindowProxy::setGlobal(v8::Local<v8::Object> global) { 121 void WindowProxy::setGlobal(v8::Local<v8::Object> global) {
122 DCHECK(m_lifecycle == Lifecycle::ContextUninitialized);
123
125 m_globalProxy.set(m_isolate, global); 124 m_globalProxy.set(m_isolate, global);
126 125
127 // Initialize the window proxy now, to re-establish the connection between 126 // Initialize the window proxy now, to re-establish the connection between
128 // the global object and the v8::Context. This is really only needed for a 127 // the global object and the v8::Context. This is really only needed for a
129 // RemoteDOMWindow, since it has no scripting environment of its own. 128 // RemoteDOMWindow, since it has no scripting environment of its own.
130 // Without this, existing script references to a swapped in RemoteDOMWindow 129 // Without this, existing script references to a swapped in RemoteDOMWindow
131 // would be broken until that RemoteDOMWindow was vended again through an 130 // would be broken until that RemoteDOMWindow was vended again through an
132 // interface like window.frames. 131 // interface like window.frames.
133 initializeIfNeeded(); 132 initializeIfNeeded();
134 } 133 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 V8DOMWrapper::setNativeInfo(m_isolate, windowProperties, wrapperTypeInfo, 236 V8DOMWrapper::setNativeInfo(m_isolate, windowProperties, wrapperTypeInfo,
238 window); 237 window);
239 238
240 // TODO(keishi): Remove installPagePopupController and implement 239 // TODO(keishi): Remove installPagePopupController and implement
241 // PagePopupController in another way. 240 // PagePopupController in another way.
242 V8PagePopupControllerBinding::installPagePopupController(context, 241 V8PagePopupControllerBinding::installPagePopupController(context,
243 windowWrapper); 242 windowWrapper);
244 } 243 }
245 244
246 } // namespace blink 245 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698