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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 script_state_->DisposePerContextData(); 101 script_state_->DisposePerContextData();
102 102
103 // It's likely that disposing the context has created a lot of 103 // It's likely that disposing the context has created a lot of
104 // garbage. Notify V8 about this so it'll have a chance of cleaning 104 // garbage. Notify V8 about this so it'll have a chance of cleaning
105 // it up when idle. 105 // it up when idle.
106 V8GCForContextDispose::Instance().NotifyContextDisposed( 106 V8GCForContextDispose::Instance().NotifyContextDisposed(
107 GetFrame()->IsMainFrame()); 107 GetFrame()->IsMainFrame());
108 108
109 if (next_status == Lifecycle::kFrameIsDetached) {
110 // The context's frame is detached from the DOM, so there shouldn't be a
111 // strong reference to the context.
112 global_proxy_.SetPhantom();
113 }
114
109 DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized); 115 DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized);
110 lifecycle_ = next_status; 116 lifecycle_ = next_status;
111 } 117 }
112 118
113 void LocalWindowProxy::Initialize() { 119 void LocalWindowProxy::Initialize() {
114 TRACE_EVENT1("v8", "LocalWindowProxy::initialize", "isMainWindow", 120 TRACE_EVENT1("v8", "LocalWindowProxy::initialize", "isMainWindow",
115 GetFrame()->IsMainFrame()); 121 GetFrame()->IsMainFrame());
116 SCOPED_BLINK_UMA_HISTOGRAM_TIMER( 122 SCOPED_BLINK_UMA_HISTOGRAM_TIMER(
117 GetFrame()->IsMainFrame() 123 GetFrame()->IsMainFrame()
118 ? "Blink.Binding.InitializeMainLocalWindowProxy" 124 ? "Blink.Binding.InitializeMainLocalWindowProxy"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 449
444 SetSecurityToken(origin); 450 SetSecurityToken(origin);
445 } 451 }
446 452
447 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate, 453 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate,
448 LocalFrame& frame, 454 LocalFrame& frame,
449 RefPtr<DOMWrapperWorld> world) 455 RefPtr<DOMWrapperWorld> world)
450 : WindowProxy(isolate, frame, std::move(world)) {} 456 : WindowProxy(isolate, frame, std::move(world)) {}
451 457
452 } // namespace blink 458 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698