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

Unified Diff: Source/bindings/v8/ScriptState.cpp

Issue 351423002: Moved files under Source/bindings/v8 to Source/bindings/core/v8. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/bindings/v8/ScriptState.h ('k') | Source/bindings/v8/ScriptString.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ScriptState.cpp
diff --git a/Source/bindings/v8/ScriptState.cpp b/Source/bindings/v8/ScriptState.cpp
deleted file mode 100644
index 5e17e4c6da8ddc8f86d477977c2643845d31d814..0000000000000000000000000000000000000000
--- a/Source/bindings/v8/ScriptState.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2014 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 "config.h"
-#include "bindings/v8/ScriptState.h"
-
-#include "bindings/v8/V8Binding.h"
-#include "core/dom/ExecutionContext.h"
-#include "core/frame/LocalFrame.h"
-
-namespace WebCore {
-
-PassRefPtr<ScriptState> ScriptState::create(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
-{
- RefPtr<ScriptState> scriptState = adoptRef(new ScriptState(context, world));
- // This ref() is for keeping this ScriptState alive as long as the v8::Context is alive.
- // This is deref()ed in the weak callback of the v8::Context.
- scriptState->ref();
- return scriptState;
-}
-
-static void weakCallback(const v8::WeakCallbackData<v8::Context, ScriptState>& data)
-{
- data.GetValue()->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex, 0);
- data.GetParameter()->clearContext();
- data.GetParameter()->deref();
-}
-
-ScriptState::ScriptState(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
- : m_isolate(context->GetIsolate())
- , m_context(m_isolate, context)
- , m_world(world)
- , m_perContextData(V8PerContextData::create(context))
-{
- ASSERT(m_world);
- m_context.setWeak(this, &weakCallback);
- context->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex, this);
-}
-
-ScriptState::~ScriptState()
-{
- ASSERT(!m_perContextData);
- ASSERT(m_context.isEmpty());
-}
-
-bool ScriptState::evalEnabled() const
-{
- v8::HandleScope handleScope(m_isolate);
- return context()->IsCodeGenerationFromStringsAllowed();
-}
-
-void ScriptState::setEvalEnabled(bool enabled)
-{
- v8::HandleScope handleScope(m_isolate);
- return context()->AllowCodeGenerationFromStrings(enabled);
-}
-
-ScriptValue ScriptState::getFromGlobalObject(const char* name)
-{
- v8::HandleScope handleScope(m_isolate);
- v8::Local<v8::Value> v8Value = context()->Global()->Get(v8AtomicString(isolate(), name));
- return ScriptValue(this, v8Value);
-}
-
-ExecutionContext* ScriptState::executionContext() const
-{
- v8::HandleScope scope(m_isolate);
- return toExecutionContext(context());
-}
-
-void ScriptState::setExecutionContext(ExecutionContext*)
-{
- ASSERT_NOT_REACHED();
-}
-
-LocalDOMWindow* ScriptState::domWindow() const
-{
- v8::HandleScope scope(m_isolate);
- return toDOMWindow(context());
-}
-
-ScriptState* ScriptState::forMainWorld(LocalFrame* frame)
-{
- v8::Isolate* isolate = toIsolate(frame);
- v8::HandleScope handleScope(isolate);
- return ScriptState::from(toV8Context(frame, DOMWrapperWorld::mainWorld()));
-}
-
-PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
-{
- RefPtr<ScriptStateForTesting> scriptState = adoptRef(new ScriptStateForTesting(context, world));
- // This ref() is for keeping this ScriptState alive as long as the v8::Context is alive.
- // This is deref()ed in the weak callback of the v8::Context.
- scriptState->ref();
- return scriptState;
-}
-
-ScriptStateForTesting::ScriptStateForTesting(v8::Handle<v8::Context> context, PassRefPtr<DOMWrapperWorld> world)
- : ScriptState(context, world)
-{
-}
-
-ExecutionContext* ScriptStateForTesting::executionContext() const
-{
- return m_executionContext;
-}
-
-void ScriptStateForTesting::setExecutionContext(ExecutionContext* executionContext)
-{
- m_executionContext = executionContext;
-}
-
-}
« no previous file with comments | « Source/bindings/v8/ScriptState.h ('k') | Source/bindings/v8/ScriptString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698