Chromium Code Reviews| 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 78aef15a9d01f45675be479808f4222c0a4e14bb..f3948344c3cb9617d6f8a42aa3dc9147bcf85006 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp |
| @@ -28,51 +28,22 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#include "bindings/core/v8/WindowProxy.h" |
|
dcheng
2017/03/08 06:09:32
I guess I never fixed this copy and paste error...
|
| +#include "bindings/core/v8/RemoteWindowProxy.h" |
| #include <algorithm> |
| #include <utility> |
| -#include "bindings/core/v8/ConditionalFeatures.h" |
|
dcheng
2017/03/08 06:09:32
Trim these headers now since they're all unused.
|
| #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/V8DOMWrapper.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 { |
| @@ -85,7 +56,32 @@ void RemoteWindowProxy::disposeContext(GlobalDetachmentBehavior behavior) { |
| if (m_lifecycle != Lifecycle::ContextInitialized) |
| return; |
| - WindowProxy::disposeContext(behavior); |
| + 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(); |
| + } |
| + |
| + 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; |
| } |
| void RemoteWindowProxy::initialize() { |