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

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

Issue 2843603002: Move ScriptWrappable and dependencies to platform/bindings (Closed)
Patch Set: Rebase and try again 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp b/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp
deleted file mode 100644
index ee180e7361d10e585cb44dc0977bfe93eb025729..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/bindings/core/v8/ActiveScriptWrappable.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "bindings/core/v8/ActiveScriptWrappable.h"
-
-#include "bindings/core/v8/DOMDataStore.h"
-#include "bindings/core/v8/ScriptWrappable.h"
-#include "bindings/core/v8/ScriptWrappableVisitor.h"
-#include "bindings/core/v8/V8Binding.h"
-#include "bindings/core/v8/V8PerIsolateData.h"
-#include "core/dom/ExecutionContext.h"
-
-namespace blink {
-
-ActiveScriptWrappableBase::ActiveScriptWrappableBase() {
- DCHECK(ThreadState::Current());
- v8::Isolate* isolate = ThreadState::Current()->GetIsolate();
- V8PerIsolateData* isolate_data = V8PerIsolateData::From(isolate);
- isolate_data->AddActiveScriptWrappable(this);
-}
-
-void ActiveScriptWrappableBase::TraceActiveScriptWrappables(
- v8::Isolate* isolate,
- ScriptWrappableVisitor* visitor) {
- V8PerIsolateData* isolate_data = V8PerIsolateData::From(isolate);
- auto active_script_wrappables = isolate_data->ActiveScriptWrappables();
- if (!active_script_wrappables) {
- return;
- }
-
- for (auto active_wrappable : *active_script_wrappables) {
- if (!active_wrappable->DispatchHasPendingActivity(active_wrappable)) {
- continue;
- }
-
- // A wrapper isn't kept alive after its ExecutionContext becomes
- // detached, even if hasPendingActivity() returns |true|. This measure
- // avoids memory leaks and has proven not to be too eager wrt
- // garbage collection of objects belonging to discarded browser contexts
- // ( https://html.spec.whatwg.org/#a-browsing-context-is-discarded )
- //
- // Consequently, an implementation of hasPendingActivity() is
- // not required to take the detached state of the associated
- // ExecutionContext into account (i.e., return |false|.) We probe
- // the detached state of the ExecutionContext via
- // |isContextDestroyed()|.
- //
- // TODO(haraken): Implement correct lifetime using traceWrapper.
- if (active_wrappable->IsContextDestroyed(active_wrappable)) {
- continue;
- }
-
- auto script_wrappable =
- active_wrappable->ToScriptWrappable(active_wrappable);
- auto wrapper_type_info =
- const_cast<WrapperTypeInfo*>(script_wrappable->GetWrapperTypeInfo());
- visitor->RegisterV8Reference(
- std::make_pair(wrapper_type_info, script_wrappable));
- }
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698