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

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

Issue 2732153002: Revert of Prepare WindowProxy for using v8::Context::NewRemoteContext(). (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/RemoteWindowProxy.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp b/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp
index eaa8bbed0d4daa7644a1b8d855b4a080be487b87..d5c6f4a20bc4b6aeb93ed45426617dcd2c01074a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp
@@ -28,20 +28,50 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "bindings/core/v8/RemoteWindowProxy.h"
+#include "bindings/core/v8/WindowProxy.h"
+#include <algorithm>
#include <utility>
+#include "bindings/core/v8/ConditionalFeatures.h"
#include "bindings/core/v8/DOMWrapperWorld.h"
+#include "bindings/core/v8/ScriptController.h"
+#include "bindings/core/v8/ToV8.h"
+#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8DOMActivityLogger.h"
+#include "bindings/core/v8/V8Document.h"
#include "bindings/core/v8/V8GCForContextDispose.h"
+#include "bindings/core/v8/V8HTMLCollection.h"
+#include "bindings/core/v8/V8HTMLDocument.h"
+#include "bindings/core/v8/V8HiddenValue.h"
+#include "bindings/core/v8/V8Initializer.h"
+#include "bindings/core/v8/V8ObjectConstructor.h"
+#include "bindings/core/v8/V8PagePopupControllerBinding.h"
+#include "bindings/core/v8/V8PrivateProperty.h"
#include "bindings/core/v8/V8Window.h"
+#include "core/frame/LocalFrame.h"
+#include "core/frame/LocalFrameClient.h"
+#include "core/frame/csp/ContentSecurityPolicy.h"
+#include "core/html/DocumentNameCollection.h"
+#include "core/html/HTMLCollection.h"
+#include "core/html/HTMLIFrameElement.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/inspector/MainThreadDebugger.h"
+#include "core/loader/DocumentLoader.h"
+#include "core/loader/FrameLoader.h"
+#include "core/origin_trials/OriginTrialContext.h"
#include "platform/Histogram.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/ScriptForbiddenScope.h"
#include "platform/heap/Handle.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
+#include "platform/weborigin/SecurityOrigin.h"
+#include "public/platform/Platform.h"
+#include "v8/include/v8-debug.h"
#include "v8/include/v8.h"
#include "wtf/Assertions.h"
+#include "wtf/StringExtras.h"
+#include "wtf/text/CString.h"
namespace blink {
@@ -54,36 +84,7 @@
if (m_lifecycle != Lifecycle::ContextInitialized)
return;
- if (behavior == DetachGlobal) {
- v8::Local<v8::Context> context = m_scriptState->context();
- // Clean up state on the global proxy, which will be reused.
- if (!m_globalProxy.isEmpty()) {
- // TODO(yukishiino): This DCHECK failed on Canary (M57) and Dev (M56).
- // We need to figure out why m_globalProxy != context->Global().
- DCHECK(m_globalProxy == context->Global());
- DCHECK_EQ(toScriptWrappable(context->Global()),
- toScriptWrappable(
- context->Global()->GetPrototype().As<v8::Object>()));
- m_globalProxy.get().SetWrapperClassId(0);
- }
- V8DOMWrapper::clearNativeInfo(isolate(), context->Global());
- m_scriptState->detachGlobalObject();
-
-#if DCHECK_IS_ON()
- didDetachGlobalProxy();
-#endif
- }
-
- m_scriptState->disposePerContextData();
-
- // It's likely that disposing the context has created a lot of
- // garbage. Notify V8 about this so it'll have a chance of cleaning
- // it up when idle.
- V8GCForContextDispose::instance().notifyContextDisposed(
- frame()->isMainFrame());
-
- DCHECK(m_lifecycle == Lifecycle::ContextInitialized);
- m_lifecycle = Lifecycle::ContextDetached;
+ WindowProxy::disposeContext(behavior);
}
void RemoteWindowProxy::initialize() {
@@ -112,49 +113,12 @@
context->UseDefaultSecurityToken();
}
-void RemoteWindowProxy::setupWindowPrototypeChain() {
- // Associate the window wrapper object and its prototype chain with the
- // corresponding native DOMWindow object.
- DOMWindow* window = frame()->domWindow();
- const WrapperTypeInfo* wrapperTypeInfo = window->wrapperTypeInfo();
- v8::Local<v8::Context> context = m_scriptState->context();
-
- // The global proxy object. Note this is not the global object.
- v8::Local<v8::Object> globalProxy = context->Global();
- CHECK(m_globalProxy == globalProxy);
- V8DOMWrapper::setNativeInfo(isolate(), globalProxy, wrapperTypeInfo, window);
- // Mark the handle to be traced by Oilpan, since the global proxy has a
- // reference to the DOMWindow.
- m_globalProxy.get().SetWrapperClassId(wrapperTypeInfo->wrapperClassId);
-
-#if DCHECK_IS_ON()
- didAttachGlobalProxy();
-#endif
-
- // The global object, aka window wrapper object.
- v8::Local<v8::Object> windowWrapper =
- globalProxy->GetPrototype().As<v8::Object>();
- V8DOMWrapper::setNativeInfo(isolate(), windowWrapper, wrapperTypeInfo,
- window);
-
- // The prototype object of Window interface.
- v8::Local<v8::Object> windowPrototype =
- windowWrapper->GetPrototype().As<v8::Object>();
- CHECK(!windowPrototype.IsEmpty());
- V8DOMWrapper::setNativeInfo(isolate(), windowPrototype, wrapperTypeInfo,
- window);
-
- // The named properties object of Window interface.
- v8::Local<v8::Object> windowProperties =
- windowPrototype->GetPrototype().As<v8::Object>();
- CHECK(!windowProperties.IsEmpty());
- V8DOMWrapper::setNativeInfo(isolate(), windowProperties, wrapperTypeInfo,
- window);
-}
-
void RemoteWindowProxy::createContext() {
// Create a new v8::Context with the window object as the global object
- // (aka the inner global). Reuse the outer global proxy if it already exists.
+ // (aka the inner global). Reuse the global proxy object (aka the outer
+ // global) if it already exists. See the comments in
+ // setupWindowPrototypeChain for the structure of the prototype chain of
+ // the global object.
v8::Local<v8::ObjectTemplate> globalTemplate =
V8Window::domTemplate(isolate(), *m_world)->InstanceTemplate();
CHECK(!globalTemplate.IsEmpty());

Powered by Google App Engine
This is Rietveld 408576698