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

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

Issue 2811943003: v8binding: Makes WindowProxy::global_proxy_ a weak reference when detached. (Closed)
Patch Set: Created 3 years, 8 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (next_status == Lifecycle::kGlobalObjectIsDetached && 59 if (next_status == Lifecycle::kGlobalObjectIsDetached &&
60 !global_proxy_.IsEmpty()) { 60 !global_proxy_.IsEmpty()) {
61 global_proxy_.Get().SetWrapperClassId(0); 61 global_proxy_.Get().SetWrapperClassId(0);
62 V8DOMWrapper::ClearNativeInfo(GetIsolate(), 62 V8DOMWrapper::ClearNativeInfo(GetIsolate(),
63 global_proxy_.NewLocal(GetIsolate())); 63 global_proxy_.NewLocal(GetIsolate()));
64 #if DCHECK_IS_ON() 64 #if DCHECK_IS_ON()
65 DidDetachGlobalObject(); 65 DidDetachGlobalObject();
66 #endif 66 #endif
67 } 67 }
68 68
69 if (next_status == Lifecycle::kFrameIsDetached) {
70 // The context's frame is detached from the DOM, so there shouldn't be a
71 // strong reference to the context.
72 global_proxy_.SetPhantom();
73 }
74
69 DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized); 75 DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized);
70 lifecycle_ = next_status; 76 lifecycle_ = next_status;
71 } 77 }
72 78
73 void RemoteWindowProxy::Initialize() { 79 void RemoteWindowProxy::Initialize() {
74 TRACE_EVENT1("v8", "RemoteWindowProxy::initialize", "isMainWindow", 80 TRACE_EVENT1("v8", "RemoteWindowProxy::initialize", "isMainWindow",
75 GetFrame()->IsMainFrame()); 81 GetFrame()->IsMainFrame());
76 SCOPED_BLINK_UMA_HISTOGRAM_TIMER( 82 SCOPED_BLINK_UMA_HISTOGRAM_TIMER(
77 GetFrame()->IsMainFrame() 83 GetFrame()->IsMainFrame()
78 ? "Blink.Binding.InitializeMainRemoteWindowProxy" 84 ? "Blink.Binding.InitializeMainRemoteWindowProxy"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 134
129 // The global object, aka window wrapper object. 135 // The global object, aka window wrapper object.
130 v8::Local<v8::Object> window_wrapper = 136 v8::Local<v8::Object> window_wrapper =
131 global_proxy->GetPrototype().As<v8::Object>(); 137 global_proxy->GetPrototype().As<v8::Object>();
132 v8::Local<v8::Object> associated_wrapper = 138 v8::Local<v8::Object> associated_wrapper =
133 AssociateWithWrapper(window, wrapper_type_info, window_wrapper); 139 AssociateWithWrapper(window, wrapper_type_info, window_wrapper);
134 DCHECK(associated_wrapper == window_wrapper); 140 DCHECK(associated_wrapper == window_wrapper);
135 } 141 }
136 142
137 } // namespace blink 143 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698