2009-08-06 Jian Li <jianli@chromium.org>
authorjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Aug 2009 21:29:23 +0000 (21:29 +0000)
committerjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Aug 2009 21:29:23 +0000 (21:29 +0000)
        Reviewed by Dimitri Glazkov.

        [V8] Style cleaning for WorkerContextExecutionProxy.
        https://bugs.webkit.org/show_bug.cgi?id=27997

        Cleanup WorkerContextExecutioonProxy related files to follow
        WebKit coding styles after all V8 binding codes are upstreamed.
        1) Lower-case the first letter of remaining functins in class
           WorkerContextExecutionProxy. Update the V8 code generator
           and all other references accordingly.
        2) Integrate getConstructor from WorkerContextExecutionProxy
           to V8DOMWrapper.
        3) Other misc changes, like removing trailing whitespaces and
           sorting the include files.

        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/v8/ScheduledAction.cpp:
        (WebCore::ScheduledAction::execute):
        * bindings/v8/V8DOMWrapper.cpp:
        (WebCore::V8DOMWrapper::getConstructorForContext):
        (WebCore::V8DOMWrapper::convertToV8Object):
        * bindings/v8/V8DOMWrapper.h:
        * bindings/v8/V8WorkerContextEventListener.cpp:
        (WebCore::V8WorkerContextEventListener::~V8WorkerContextEventListener):
        (WebCore::V8WorkerContextEventListener::handleEvent):
        (WebCore::V8WorkerContextEventListener::reportError):
        (WebCore::V8WorkerContextEventListener::getReceiverObject):
        * bindings/v8/V8WorkerContextObjectEventListener.cpp:
        (WebCore::weakObjectEventListenerCallback):
        * bindings/v8/WorkerContextExecutionProxy.cpp:
        (WebCore::handleConsoleMessage):
        (WebCore::WorkerContextExecutionProxy::dispose):
        (WebCore::WorkerContextExecutionProxy::initContextIfNeeded):
        (WebCore::WorkerContextExecutionProxy::convertToV8Object):
        (WebCore::WorkerContextExecutionProxy::convertEventToV8Object):
        (WebCore::WorkerContextExecutionProxy::convertEventTargetToV8Object):
        (WebCore::WorkerContextExecutionProxy::convertWorkerContextToV8Object):
        (WebCore::WorkerContextExecutionProxy::toV8):
        (WebCore::WorkerContextExecutionProxy::forgetV8EventObject):
        (WebCore::WorkerContextExecutionProxy::removeEventListener):
        * bindings/v8/WorkerContextExecutionProxy.h:
        (WebCore::WorkerContextExecutionProxy::context):
        (WebCore::WorkerContextExecutionProxy::convertToV8Object):
        * bindings/v8/custom/V8WorkerContextCustom.cpp:
        (WebCore::ACCESSOR_GETTER):
        (WebCore::CALLBACK_FUNC_DECL):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@46859 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/scripts/CodeGeneratorV8.pm
WebCore/bindings/v8/ScheduledAction.cpp
WebCore/bindings/v8/V8DOMWrapper.cpp
WebCore/bindings/v8/V8DOMWrapper.h
WebCore/bindings/v8/V8WorkerContextEventListener.cpp
WebCore/bindings/v8/V8WorkerContextObjectEventListener.cpp
WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
WebCore/bindings/v8/WorkerContextExecutionProxy.h
WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp

index c9ed7d9..1401aef 100644 (file)
@@ -1,3 +1,52 @@
+2009-08-06  Jian Li  <jianli@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        [V8] Style cleaning for WorkerContextExecutionProxy.
+        https://bugs.webkit.org/show_bug.cgi?id=27997
+
+        Cleanup WorkerContextExecutioonProxy related files to follow
+        WebKit coding styles after all V8 binding codes are upstreamed.
+        1) Lower-case the first letter of remaining functins in class
+           WorkerContextExecutionProxy. Update the V8 code generator
+           and all other references accordingly.
+        2) Integrate getConstructor from WorkerContextExecutionProxy
+           to V8DOMWrapper.
+        3) Other misc changes, like removing trailing whitespaces and
+           sorting the include files.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/v8/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::execute):
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::V8DOMWrapper::getConstructorForContext):
+        (WebCore::V8DOMWrapper::convertToV8Object):
+        * bindings/v8/V8DOMWrapper.h:
+        * bindings/v8/V8WorkerContextEventListener.cpp:
+        (WebCore::V8WorkerContextEventListener::~V8WorkerContextEventListener):
+        (WebCore::V8WorkerContextEventListener::handleEvent):
+        (WebCore::V8WorkerContextEventListener::reportError):
+        (WebCore::V8WorkerContextEventListener::getReceiverObject):
+        * bindings/v8/V8WorkerContextObjectEventListener.cpp:
+        (WebCore::weakObjectEventListenerCallback):
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::handleConsoleMessage):
+        (WebCore::WorkerContextExecutionProxy::dispose):
+        (WebCore::WorkerContextExecutionProxy::initContextIfNeeded):
+        (WebCore::WorkerContextExecutionProxy::convertToV8Object):
+        (WebCore::WorkerContextExecutionProxy::convertEventToV8Object):
+        (WebCore::WorkerContextExecutionProxy::convertEventTargetToV8Object):
+        (WebCore::WorkerContextExecutionProxy::convertWorkerContextToV8Object):
+        (WebCore::WorkerContextExecutionProxy::toV8):
+        (WebCore::WorkerContextExecutionProxy::forgetV8EventObject):
+        (WebCore::WorkerContextExecutionProxy::removeEventListener):
+        * bindings/v8/WorkerContextExecutionProxy.h:
+        (WebCore::WorkerContextExecutionProxy::context):
+        (WebCore::WorkerContextExecutionProxy::convertToV8Object):
+        * bindings/v8/custom/V8WorkerContextCustom.cpp:
+        (WebCore::ACCESSOR_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+
 2009-08-06  Darin Adler  <darin@apple.com>
 
         Fix Mac Leopard debug build.
index 3df2034..0774feb 100644 (file)
@@ -437,7 +437,8 @@ END
     } elsif ($classIndex eq "DEDICATEDWORKERCONTEXT" or $classIndex eq "WORKERCONTEXT" or $classIndex eq "SHAREDWORKERCONTEXT") {
         $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
         push(@implContentDecls, <<END);
-    return WorkerContextExecutionProxy::retrieve()->GetConstructor(type);
+    WorkerContext* workerContext = V8DOMWrapper::convertToNativeObject<WorkerContext>(V8ClassIndex::WORKERCONTEXT, info.Holder());
+    return V8DOMWrapper::getConstructor(type, workerContext);
 END
     } else {
         push(@implContentDecls, "    return v8::Undefined();");
@@ -2049,14 +2050,14 @@ sub ReturnNativeToJSValue
 
     if ($type eq "DedicatedWorkerContext" or $type eq "WorkerContext" or $type eq "SharedWorkerContext") {
         $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
-        return "return WorkerContextExecutionProxy::WorkerContextToV8Object($value)";
+        return "return WorkerContextExecutionProxy::convertWorkerContextToV8Object($value)";
     }
 
     if ($type eq "WorkerLocation" or $type eq "WorkerNavigator") {
         $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
         my $classIndex = uc($type);
 
-        return "return WorkerContextExecutionProxy::ToV8Object(V8ClassIndex::$classIndex, $value)";
+        return "return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::$classIndex, $value)";
     }
 
     else {
index 298f6b1..ce4ecf1 100644 (file)
@@ -134,7 +134,7 @@ void ScheduledAction::execute(WorkerContext* workerContext)
 
     if (!m_function.IsEmpty() && m_function->IsFunction()) {
         v8::HandleScope handleScope;
-        v8::Local<v8::Context> v8Context = scriptController->proxy()->GetContext();
+        v8::Local<v8::Context> v8Context = scriptController->proxy()->context();
         ASSERT(!v8Context.IsEmpty());
         v8::Context::Scope scope(v8Context);
         m_function->Call(v8Context->Global(), m_argc, m_argv);
index f0c3a79..b226ebd 100644 (file)
@@ -492,10 +492,19 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
     if (value.IsEmpty())
         return v8::Local<v8::Function>();
     // Hotmail fix, see comments above.
-    value->Set(v8::String::New("__proto__"), objectPrototype);
+    if (!objectPrototype.IsEmpty())
+        value->Set(v8::String::New("__proto__"), objectPrototype);
     return value;
 }
 
+v8::Local<v8::Function> V8DOMWrapper::getConstructorForContext(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Context> context)
+{
+    // Enter the scope for this context to get the correct constructor.
+    v8::Context::Scope scope(context);
+
+    return getConstructor(type, V8Proxy::getHiddenObjectPrototype(context));
+}
+
 v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, DOMWindow* window)
 {
     Frame* frame = window->frame();
@@ -505,10 +514,21 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
     v8::Handle<v8::Context> context = V8Proxy::context(frame);
     if (context.IsEmpty())
         return v8::Local<v8::Function>();
-    // Enter the scope for this DOMWindow to get the correct constructor.
-    v8::Context::Scope scope(context);
 
-    return getConstructor(type, V8Proxy::getHiddenObjectPrototype(context));
+    return getConstructorForContext(type, context);
+}
+
+v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, WorkerContext*)
+{
+    WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve();
+    if (!proxy)
+        return v8::Local<v8::Function>();
+
+    v8::Handle<v8::Context> context = proxy->context();
+    if (context.IsEmpty())
+        return v8::Local<v8::Function>();
+
+    return getConstructorForContext(type, context);
 }
 
 v8::Handle<v8::Value> V8DOMWrapper::convertToV8Object(V8ClassIndex::V8WrapperType type, void* impl)
@@ -525,7 +545,7 @@ v8::Handle<v8::Value> V8DOMWrapper::convertToV8Object(V8ClassIndex::V8WrapperTyp
          || type == V8ClassIndex::XMLHTTPREQUESTEXCEPTION
          || type == V8ClassIndex::MESSAGEPORT)
         && WorkerContextExecutionProxy::retrieve()) {
-        return WorkerContextExecutionProxy::ToV8Object(type, impl);
+        return WorkerContextExecutionProxy::convertToV8Object(type, impl);
     }
 
     bool isActiveDomObject = false;
index f6230ec..66b0563 100644 (file)
@@ -86,6 +86,7 @@ namespace WebCore {
     class StyleSheetList;
     class V8EventListener;
     class V8ObjectEventListener;
+    class WorkerContext;
 
     class V8DOMWrapper {
     public:
@@ -196,8 +197,10 @@ namespace WebCore {
         static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>);
 
         static v8::Persistent<v8::FunctionTemplate> getTemplate(V8ClassIndex::V8WrapperType);
+        static v8::Local<v8::Function> getConstructorForContext(V8ClassIndex::V8WrapperType, v8::Handle<v8::Context>);
         static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, v8::Handle<v8::Value> objectPrototype);
         static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, DOMWindow*);
+        static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, WorkerContext*);
 
         // Checks whether a DOM object has a JS wrapper.
         static bool domObjectHasJSWrapper(void*);
index 9ae5cd8..3d28017 100644 (file)
@@ -49,7 +49,7 @@ V8WorkerContextEventListener::V8WorkerContextEventListener(WorkerContextExecutio
 V8WorkerContextEventListener::~V8WorkerContextEventListener()
 {
     if (m_proxy)
-        m_proxy->RemoveEventListener(this);
+        m_proxy->removeEventListener(this);
     disposeListenerObject();
 }
 
@@ -65,7 +65,7 @@ void V8WorkerContextEventListener::handleEvent(Event* event, bool isWindowEvent)
 
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = m_proxy->GetContext();
+    v8::Handle<v8::Context> context = m_proxy->context();
     if (context.IsEmpty())
         return;
 
@@ -73,7 +73,7 @@ void V8WorkerContextEventListener::handleEvent(Event* event, bool isWindowEvent)
     v8::Context::Scope scope(context);
 
     // Get the V8 wrapper for the event object.
-    v8::Handle<v8::Value> jsEvent = WorkerContextExecutionProxy::EventToV8Object(event);
+    v8::Handle<v8::Value> jsEvent = WorkerContextExecutionProxy::convertEventToV8Object(event);
 
     invokeEventHandler(context, event, jsEvent, isWindowEvent);
 }
@@ -89,7 +89,7 @@ bool V8WorkerContextEventListener::reportError(const String& message, const Stri
 
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> context = m_proxy->GetContext();
+    v8::Handle<v8::Context> context = m_proxy->context();
     if (context.IsEmpty())
         return false;
 
@@ -148,7 +148,7 @@ v8::Local<v8::Object> V8WorkerContextEventListener::getReceiverObject(Event* eve
         return v8::Context::GetCurrent()->Global();
 
     EventTarget* target = event->currentTarget();
-    v8::Handle<v8::Value> value = WorkerContextExecutionProxy::EventTargetToV8Object(target);
+    v8::Handle<v8::Value> value = WorkerContextExecutionProxy::convertEventTargetToV8Object(target);
     if (value.IsEmpty())
         return v8::Local<v8::Object>();
     return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
index bec25f1..ce56563 100644 (file)
@@ -43,7 +43,7 @@ static void weakObjectEventListenerCallback(v8::Persistent<v8::Value>, void* par
     V8WorkerContextObjectEventListener* listener = static_cast<V8WorkerContextObjectEventListener*>(parameter);
 
     // Remove the wrapper
-    listener->proxy()->RemoveEventListener(listener);
+    listener->proxy()->removeEventListener(listener);
 
     listener->disposeListenerObject();
 }
index fb65f60..61f582b 100644 (file)
@@ -35,8 +35,8 @@
 
 #include "WorkerContextExecutionProxy.h"
 
-#include "DedicatedWorkerContext.h"
 #include "DOMCoreException.h"
+#include "DedicatedWorkerContext.h"
 #include "Event.h"
 #include "EventException.h"
 #include "MessagePort.h"
@@ -68,19 +68,19 @@ static void handleConsoleMessage(v8::Handle<v8::Message> message, v8::Handle<v8:
     WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve();
     if (!proxy)
         return;
-    
+
     WorkerContext* workerContext = proxy->workerContext();
     if (!workerContext)
         return;
-    
+
     v8::Handle<v8::String> errorMessageString = message->Get();
     ASSERT(!errorMessageString.IsEmpty());
     String errorMessage = toWebCoreString(errorMessageString);
-    
+
     v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
     bool useURL = (resourceName.IsEmpty() || !resourceName->IsString());
     String resourceNameString = useURL ? workerContext->url() : toWebCoreString(resourceName);
-    
+
     workerContext->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, errorMessage, message->GetLineNumber(), resourceNameString);
 }
 
@@ -99,8 +99,7 @@ WorkerContextExecutionProxy::~WorkerContextExecutionProxy()
 void WorkerContextExecutionProxy::dispose()
 {
     // Disconnect all event listeners.
-    if (m_listeners.get())
-    {
+    if (m_listeners.get()) {
         for (V8EventListenerList::iterator iterator(m_listeners->begin()); iterator != m_listeners->end(); ++iterator)
            static_cast<V8WorkerContextEventListener*>(*iterator)->disconnect();
 
@@ -172,7 +171,7 @@ void WorkerContextExecutionProxy::initContextIfNeeded()
     v8::Handle<v8::String> implicitProtoString = v8::String::New("__proto__");
 
     // Create a new JS object and use it as the prototype for the shadow global object.
-    v8::Handle<v8::Function> workerContextConstructor = GetConstructor(V8ClassIndex::DEDICATEDWORKERCONTEXT);
+    v8::Handle<v8::Function> workerContextConstructor = V8DOMWrapper::getConstructorForContext(V8ClassIndex::DEDICATEDWORKERCONTEXT, context);
     v8::Local<v8::Object> jsWorkerContext = SafeAllocation::newInstance(workerContextConstructor);
     // Bail out if allocation failed.
     if (jsWorkerContext.IsEmpty()) {
@@ -193,29 +192,13 @@ void WorkerContextExecutionProxy::initContextIfNeeded()
     m_listeners.set(new V8EventListenerList());
 }
 
-v8::Local<v8::Function> WorkerContextExecutionProxy::GetConstructor(V8ClassIndex::V8WrapperType type)
-{
-    // Enter the context of the proxy to make sure that the function is
-    // constructed in the context corresponding to this proxy.
-    v8::Context::Scope scope(m_context);
-    v8::Handle<v8::FunctionTemplate> functionTemplate = V8DOMWrapper::getTemplate(type);
-
-    // Getting the function might fail if we're running out of stack or memory.
-    v8::TryCatch tryCatch;
-    v8::Local<v8::Function> value = functionTemplate->GetFunction();
-    if (value.IsEmpty())
-        return v8::Local<v8::Function>();
-
-    return value;
-}
-
-v8::Handle<v8::Value> WorkerContextExecutionProxy::ToV8Object(V8ClassIndex::V8WrapperType type, void* impl)
+v8::Handle<v8::Value> WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::V8WrapperType type, void* impl)
 {
     if (!impl)
         return v8::Null();
 
     if (type == V8ClassIndex::DEDICATEDWORKERCONTEXT)
-        return WorkerContextToV8Object(static_cast<WorkerContext*>(impl));
+        return convertWorkerContextToV8Object(static_cast<WorkerContext*>(impl));
 
     bool isActiveDomObject = false;
     switch (type) {
@@ -282,7 +265,7 @@ v8::Handle<v8::Value> WorkerContextExecutionProxy::ToV8Object(V8ClassIndex::V8Wr
     return result;
 }
 
-v8::Handle<v8::Value> WorkerContextExecutionProxy::EventToV8Object(Event* event)
+v8::Handle<v8::Value> WorkerContextExecutionProxy::convertEventToV8Object(Event* event)
 {
     if (!event)
         return v8::Null();
@@ -299,7 +282,7 @@ v8::Handle<v8::Value> WorkerContextExecutionProxy::EventToV8Object(Event* event)
     v8::Handle<v8::Object> result = toV8(type, V8ClassIndex::EVENT, event);
     if (result.IsEmpty()) {
         // Instantiation failed. Avoid updating the DOM object map and return null which
-        // is already handled by callers of this function in case the event is NULL.
+        // is already handled by callers of this function in case the event is null.
         return v8::Null();
     }
 
@@ -309,57 +292,56 @@ v8::Handle<v8::Value> WorkerContextExecutionProxy::EventToV8Object(Event* event)
     return result;
 }
 
-v8::Handle<v8::Value> WorkerContextExecutionProxy::EventTargetToV8Object(EventTarget* target)
+v8::Handle<v8::Value> WorkerContextExecutionProxy::convertEventTargetToV8Object(EventTarget* target)
 {
     if (!target)
         return v8::Null();
 
     DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext();
     if (workerContext)
-        return WorkerContextToV8Object(workerContext);
+        return convertWorkerContextToV8Object(workerContext);
 
     Worker* worker = target->toWorker();
     if (worker)
-        return ToV8Object(V8ClassIndex::WORKER, worker);
+        return convertToV8Object(V8ClassIndex::WORKER, worker);
 
     XMLHttpRequest* xhr = target->toXMLHttpRequest();
     if (xhr)
-        return ToV8Object(V8ClassIndex::XMLHTTPREQUEST, xhr);
+        return convertToV8Object(V8ClassIndex::XMLHTTPREQUEST, xhr);
 
     MessagePort* mp = target->toMessagePort();
     if (mp)
-        return ToV8Object(V8ClassIndex::MESSAGEPORT, mp);
+        return convertToV8Object(V8ClassIndex::MESSAGEPORT, mp);
 
     ASSERT_NOT_REACHED();
     return v8::Handle<v8::Value>();
 }
 
-v8::Handle<v8::Value> WorkerContextExecutionProxy::WorkerContextToV8Object(WorkerContext* workerContext)
+v8::Handle<v8::Value> WorkerContextExecutionProxy::convertWorkerContextToV8Object(WorkerContext* workerContext)
 {
     if (!workerContext)
         return v8::Null();
 
-    v8::Handle<v8::Context> context = workerContext->script()->proxy()->GetContext();
+    v8::Handle<v8::Context> context = workerContext->script()->proxy()->context();
 
     v8::Handle<v8::Object> global = context->Global();
     ASSERT(!global.IsEmpty());
     return global;
 }
 
-v8::Local<v8::Object> WorkerContextExecutionProxy::toV8(V8ClassIndex::V8WrapperType descType, V8ClassIndex::V8WrapperType cptrType, void* impl)
+v8::Local<v8::Object> WorkerContextExecutionProxy::toV8(V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl)
 {
     v8::Local<v8::Function> function;
     WorkerContextExecutionProxy* proxy = retrieve();
     if (proxy)
-        function = proxy->GetConstructor(descType);
+        function = V8DOMWrapper::getConstructor(descriptorType, proxy->workerContext());
     else
-        function = V8DOMWrapper::getTemplate(descType)->GetFunction();
+        function = V8DOMWrapper::getTemplate(descriptorType)->GetFunction();
 
     v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
-    if (!instance.IsEmpty()) {
+    if (!instance.IsEmpty())
         // Avoid setting the DOM wrapper for failed allocations.
         V8DOMWrapper::setDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl);
-    }
     return instance;
 }
 
@@ -368,8 +350,8 @@ bool WorkerContextExecutionProxy::forgetV8EventObject(Event* event)
     if (getDOMObjectMap().contains(event)) {
         getDOMObjectMap().forget(event);
         return true;
-    } else
-        return false;
+    }
+    return false;
 }
 
 ScriptValue WorkerContextExecutionProxy::evaluate(const String& script, const String& fileName, int baseLine, WorkerContextExecutionState* state)
@@ -464,7 +446,7 @@ PassRefPtr<V8EventListener> WorkerContextExecutionProxy::findOrCreateObjectEvent
     return findOrCreateEventListenerHelper(object, isInline, findOnly, true);
 }
 
-void WorkerContextExecutionProxy::RemoveEventListener(V8EventListener* listener)
+void WorkerContextExecutionProxy::removeEventListener(V8EventListener* listener)
 {
     m_listeners->remove(listener);
 }
index 637f956..75024df 100644 (file)
 
 #if ENABLE(WORKERS)
 
-#include <v8.h>
 #include "ScriptValue.h"
 #include "V8EventListenerList.h"
 #include "V8Index.h"
+#include <v8.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
 
@@ -64,15 +64,7 @@ namespace WebCore {
         WorkerContextExecutionProxy(WorkerContext*);
         ~WorkerContextExecutionProxy();
 
-        // FIXME: following function should have camelCased names once V8 code-generating script is migrated.
-        v8::Local<v8::Context> GetContext() { return v8::Local<v8::Context>::New(m_context); }
-        v8::Local<v8::Function> GetConstructor(V8ClassIndex::V8WrapperType);
-        void RemoveEventListener(V8EventListener*);
-
-        static v8::Handle<v8::Value> ToV8Object(V8ClassIndex::V8WrapperType type, void* impl);
-        static v8::Handle<v8::Value> EventToV8Object(Event* event);
-        static v8::Handle<v8::Value> EventTargetToV8Object(EventTarget* target);
-        static v8::Handle<v8::Value> WorkerContextToV8Object(WorkerContext* wc);
+        void removeEventListener(V8EventListener*);
 
         // Finds/creates event listener wrappers.
         PassRefPtr<V8EventListener> findOrCreateEventListener(v8::Local<v8::Value> listener, bool isInline, bool findOnly);
@@ -87,12 +79,26 @@ namespace WebCore {
         // Evaluate a script file in the current execution environment.
         ScriptValue evaluate(const String& script, const String& fileName, int baseLine, WorkerContextExecutionState*);
 
+        // Returns a local handle of the context.
+        v8::Local<v8::Context> context() { return v8::Local<v8::Context>::New(m_context); }
+
         // Returns WorkerContext object.
         WorkerContext* workerContext() { return m_workerContext; }
 
         // Returns WorkerContextExecutionProxy object of the currently executing context. 0 will be returned if the current executing context is not the worker context.
         static WorkerContextExecutionProxy* retrieve();
 
+        // We have to keep all these conversion functions here before WorkerContextExecutionProxy is refactor-ed.
+        template<typename T>
+        static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType type, PassRefPtr<T> impl)
+        {
+            return convertToV8Object(type, impl.get());
+        }
+        static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType, void* impl);
+        static v8::Handle<v8::Value> convertEventToV8Object(Event*);
+        static v8::Handle<v8::Value> convertEventTargetToV8Object(EventTarget*);
+        static v8::Handle<v8::Value> convertWorkerContextToV8Object(WorkerContext*);
+
     private:
         void initV8IfNeeded();
         void initContextIfNeeded();
@@ -101,7 +107,7 @@ namespace WebCore {
         // Run an already compiled script.
         v8::Local<v8::Value> runScript(v8::Handle<v8::Script>);
 
-        static v8::Local<v8::Object> toV8(V8ClassIndex::V8WrapperType descType, V8ClassIndex::V8WrapperType cptrType, void* impl);
+        static v8::Local<v8::Object> toV8(V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl);
 
         static bool forgetV8EventObject(Event*);
 
index 9e79fa9..1e3e125 100644 (file)
 
 #if ENABLE(WORKERS)
 
-#include "WorkerContextExecutionProxy.h"
-
-#include "ExceptionCode.h"
 #include "DOMTimer.h"
+#include "ExceptionCode.h"
 #include "ScheduledAction.h"
 #include "V8Binding.h"
 #include "V8CustomBinding.h"
@@ -43,6 +41,7 @@
 #include "V8Utilities.h"
 #include "V8WorkerContextEventListener.h"
 #include "WorkerContext.h"
+#include "WorkerContextExecutionProxy.h"
 
 namespace WebCore {
 
@@ -50,7 +49,7 @@ ACCESSOR_GETTER(WorkerContextSelf)
 {
     INC_STATS(L"DOM.WorkerContext.self._get");
     WorkerContext* workerContext = V8DOMWrapper::convertDOMWrapperToNative<WorkerContext>(info.Holder());
-    return WorkerContextExecutionProxy::WorkerContextToV8Object(workerContext);
+    return WorkerContextExecutionProxy::convertWorkerContextToV8Object(workerContext);
 }
 
 ACCESSOR_GETTER(WorkerContextOnerror)
@@ -160,7 +159,8 @@ CALLBACK_FUNC_DECL(WorkerContextSetTimeout)
     return SetTimeoutOrInterval(args, true);
 }
 
-CALLBACK_FUNC_DECL(WorkerContextSetInterval) {
+CALLBACK_FUNC_DECL(WorkerContextSetInterval)
+{
     INC_STATS(L"DOM.WorkerContext.setInterval()");
     return SetTimeoutOrInterval(args, false);
 }