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

Unified Diff: Source/WebCore/bindings/v8/ScriptController.cpp

Issue 8806015: Changes to support a second VM. (Closed) Base URL: svn://svn.chromium.org/dash/experimental/chrome/src/webkit-full
Patch Set: . Created 9 years 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/WebCore/bindings/v8/ScriptController.h ('k') | Source/WebCore/bindings/v8/ScriptSourceCode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/v8/ScriptController.cpp
diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp
index 9643960ba906f6a8cbc89597e13674f0d2ac73d6..54c3d16d164bda238abe535f23d2bb51066d0e98 100644
--- a/Source/WebCore/bindings/v8/ScriptController.cpp
+++ b/Source/WebCore/bindings/v8/ScriptController.cpp
@@ -33,6 +33,7 @@
#include "ScriptController.h"
#include "PlatformSupport.h"
+#include "DartController.h"
vsm 2011/12/05 17:20:28 We should refactor ScriptController to bindings/pu
#include "Document.h"
#include "ScriptCallStack.h"
#include "ScriptCallStackFactory.h"
@@ -117,6 +118,8 @@ ScriptController::ScriptController(Frame* frame)
, m_wrappedWindowScriptNPObject(0)
#endif
{
+ // FIXME: should be set from outside.
+ m_controllers.set("dart", DartController::create(frame));
}
ScriptController::~ScriptController()
@@ -185,6 +188,15 @@ void ScriptController::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<Se
// Evaluate a script file in the environment of this proxy.
ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
+ if (!sourceCode.mimeType().isEmpty()) {
+ for (ControllerMap::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it) {
+ if (it->second->isScriptTypeSupported(sourceCode.mimeType())) {
+ it->second->evaluate(sourceCode);
+ return ScriptValue();
+ }
+ }
+ }
+
String sourceURL = sourceCode.url();
const String* savedSourceURL = m_sourceURL;
m_sourceURL = &sourceURL;
@@ -224,6 +236,9 @@ void ScriptController::finishedWithEvent(Event* event)
// Create a V8 object with an interceptor of NPObjectPropertyGetter.
void ScriptController::bindToWindowObject(Frame* frame, const String& key, NPObject* object)
{
+ for (ControllerMap::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it)
+ it->second->bindToWindowObject(frame, key, object);
+
v8::HandleScope handleScope;
v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(frame);
@@ -446,4 +461,20 @@ void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& n
m_proxy->windowShell()->namedItemRemoved(doc, name);
}
+bool ScriptController::isScriptTypeSupported(const String& mimeType)
+{
+ if (mimeType.isEmpty())
+ return false;
+ for (ControllerMap::iterator it = m_controllers.begin(); it != m_controllers.end(); ++it) {
+ if (it->second->isScriptTypeSupported(mimeType))
+ return true;
+ }
+ return false;
+}
+
+AbstractController* ScriptController::controller(const String& name)
+{
+ return m_controllers.get(name).get();
+}
+
} // namespace WebCore
« no previous file with comments | « Source/WebCore/bindings/v8/ScriptController.h ('k') | Source/WebCore/bindings/v8/ScriptSourceCode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698