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

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 2848503002: Revert of binding: Changes the association among global-proxy/global/window-instance (2nd attempt).… (Closed)
Patch Set: Updated the test expectation. Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/DOMWindow.h" 5 #include "core/frame/DOMWindow.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "bindings/core/v8/WindowProxyManager.h" 9 #include "bindings/core/v8/WindowProxyManager.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 22 matching lines...) Expand all
33 33
34 DOMWindow::DOMWindow(Frame& frame) 34 DOMWindow::DOMWindow(Frame& frame)
35 : frame_(frame), 35 : frame_(frame),
36 window_proxy_manager_(frame.GetWindowProxyManager()), 36 window_proxy_manager_(frame.GetWindowProxyManager()),
37 location_(this, nullptr), 37 location_(this, nullptr),
38 window_is_closing_(false) {} 38 window_is_closing_(false) {}
39 39
40 DOMWindow::~DOMWindow() { 40 DOMWindow::~DOMWindow() {
41 // The frame must be disconnected before finalization. 41 // The frame must be disconnected before finalization.
42 DCHECK(!frame_); 42 DCHECK(!frame_);
43
44 // Because the wrapper object of a DOMWindow is the global proxy, which may
45 // live much longer than the DOMWindow, we need to dissociate all wrappers
46 // for this instance.
47 DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds(this);
48 } 43 }
49 44
50 v8::Local<v8::Object> DOMWindow::Wrap(v8::Isolate* isolate, 45 v8::Local<v8::Object> DOMWindow::Wrap(v8::Isolate* isolate,
51 v8::Local<v8::Object> creation_context) { 46 v8::Local<v8::Object> creation_context) {
52 // Notice that we explicitly ignore |creation_context| because the DOMWindow 47 NOTREACHED();
53 // has its own creation context. 48 return v8::Local<v8::Object>();
54
55 // TODO(yukishiino): Get understanding of why it's possible to initialize
56 // the context after the frame is detached. And then, remove the following
57 // lines. See also https://crbug.com/712638 .
58 if (!GetFrame())
59 return v8::Local<v8::Object>();
60
61 // TODO(yukishiino): Make this function always return the non-empty handle
62 // even if the frame is detached because the global proxy must always exist
63 // per spec.
64 return window_proxy_manager_
65 ->GetWindowProxy(DOMWrapperWorld::Current(isolate))
66 ->GlobalProxyIfNotDetached();
67 } 49 }
68 50
69 v8::Local<v8::Object> DOMWindow::AssociateWithWrapper( 51 v8::Local<v8::Object> DOMWindow::AssociateWithWrapper(
70 v8::Isolate*, 52 v8::Isolate*,
71 const WrapperTypeInfo*, 53 const WrapperTypeInfo*,
72 v8::Local<v8::Object> wrapper) { 54 v8::Local<v8::Object> wrapper) {
73 NOTREACHED(); 55 NOTREACHED();
74 return v8::Local<v8::Object>(); 56 return v8::Local<v8::Object>();
75 } 57 }
76 58
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 visitor->Trace(location_); 447 visitor->Trace(location_);
466 EventTargetWithInlineData::Trace(visitor); 448 EventTargetWithInlineData::Trace(visitor);
467 } 449 }
468 450
469 DEFINE_TRACE_WRAPPERS(DOMWindow) { 451 DEFINE_TRACE_WRAPPERS(DOMWindow) {
470 visitor->TraceWrappers(location_); 452 visitor->TraceWrappers(location_);
471 EventTargetWithInlineData::TraceWrappers(visitor); 453 EventTargetWithInlineData::TraceWrappers(visitor);
472 } 454 }
473 455
474 } // namespace blink 456 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698