diff options
author | dglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-10 17:30:52 +0000 |
---|---|---|
committer | dglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-10 17:30:52 +0000 |
commit | 364708017594d2576b1d408e011429dc7ff9fec9 (patch) | |
tree | 8e8899f064fff68168e1e65f012b7006110da237 | |
parent | 2ef0515038eef7ce419f4c238419c2d0fa446e60 (diff) | |
download | chromium_src-364708017594d2576b1d408e011429dc7ff9fec9.zip chromium_src-364708017594d2576b1d408e011429dc7ff9fec9.tar.gz chromium_src-364708017594d2576b1d408e011429dc7ff9fec9.tar.bz2 |
Implement cross-platform ExceptionContext (2/2)
First part #6400 committed as r3216.
Review URL: http://codereview.chromium.org/7081
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3219 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | webkit/build/KJSBindings/KJSBindings.vcproj | 8 | ||||
-rw-r--r-- | webkit/build/V8Bindings/V8Bindings.vcproj | 4 | ||||
-rw-r--r-- | webkit/build/port/port.vcproj | 4 | ||||
-rw-r--r-- | webkit/pending/ExceptionContext.h | 29 | ||||
-rw-r--r-- | webkit/port/bridge/ExceptionContextV8.cpp | 24 |
6 files changed, 45 insertions, 26 deletions
@@ -12,7 +12,7 @@ deps = { "http://googletest.googlecode.com/svn/trunk@63", "src/third_party/WebKit": - "/trunk/deps/third_party/WebKit@3170", + "/trunk/deps/third_party/WebKit@3216", "src/third_party/cygwin": "/trunk/deps/third_party/cygwin@3028", diff --git a/webkit/build/KJSBindings/KJSBindings.vcproj b/webkit/build/KJSBindings/KJSBindings.vcproj index c1f5a21..39867ef 100644 --- a/webkit/build/KJSBindings/KJSBindings.vcproj +++ b/webkit/build/KJSBindings/KJSBindings.vcproj @@ -1922,6 +1922,14 @@ > </File> <File + RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\js\ExceptionContext.cpp" + > + </File> + <File + RelativePath="..\..\pending\ExceptionContext.h" + > + </File> + <File RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\js\ScriptControllerWin.cpp" > </File> diff --git a/webkit/build/V8Bindings/V8Bindings.vcproj b/webkit/build/V8Bindings/V8Bindings.vcproj index 4e660d4..209ba50 100644 --- a/webkit/build/V8Bindings/V8Bindings.vcproj +++ b/webkit/build/V8Bindings/V8Bindings.vcproj @@ -2393,6 +2393,10 @@ > </File> <File + RelativePath="..\..\pending\ExceptionContext.h" + > + </File> + <File RelativePath="..\..\port\bridge\ExceptionContextV8.cpp" > </File> diff --git a/webkit/build/port/port.vcproj b/webkit/build/port/port.vcproj index 9f0805b..4aa94d7 100644 --- a/webkit/build/port/port.vcproj +++ b/webkit/build/port/port.vcproj @@ -1208,10 +1208,6 @@ Name="bridge" > <File - RelativePath="..\..\pending\ExceptionContext.h" - > - </File> - <File RelativePath="..\..\port\bridge\FrameWin.cpp" > </File> diff --git a/webkit/pending/ExceptionContext.h b/webkit/pending/ExceptionContext.h index 7b6c1b4..529b8f3 100644 --- a/webkit/pending/ExceptionContext.h +++ b/webkit/pending/ExceptionContext.h @@ -35,6 +35,13 @@ #include <wtf/Noncopyable.h> #include "ScriptController.h" +#if USE(JSC) +namespace KJS { +class ExecState; +} +#endif + + namespace WebCore { class Node; @@ -47,26 +54,30 @@ class ExceptionCatcher; // by the ExceptionCatcher. class ExceptionContext : Noncopyable { public: + ExceptionContext(Node*); +#if USE(V8) ExceptionContext(); - ~ExceptionContext(); +#elif USE(JSC) + ExceptionContext(KJS::ExecState* exec) : m_exec(exec) {} + KJS::ExecState* exec() const { return m_exec; } +#endif + ~ExceptionContext() {} bool hadException(); - JSException exception() const { return m_exception; } - - static ExceptionContext* createFromNode(Node*); + JSException exception() const; // Returns a non-exception code object. - static JSException NoException(); + static JSException noException(); private: - void setException(JSException exception) { m_exception = exception; } - - JSException m_exception; - #if USE(V8) friend class ExceptionCatcher; + void setException(JSException exception) { m_exception = exception; } void setExceptionCatcher(ExceptionCatcher*); + JSException m_exception; ExceptionCatcher* m_exceptionCatcher; +#elif USE(JSC) + KJS::ExecState* m_exec; #endif }; diff --git a/webkit/port/bridge/ExceptionContextV8.cpp b/webkit/port/bridge/ExceptionContextV8.cpp index 7301522..9b14d76 100644 --- a/webkit/port/bridge/ExceptionContextV8.cpp +++ b/webkit/port/bridge/ExceptionContextV8.cpp @@ -34,13 +34,17 @@ namespace WebCore { -ExceptionContext::ExceptionContext() - : m_exception() - , m_exceptionCatcher(0) +// Unlike JSC, which stores exceptions in ExecState that is accessible from +// ScriptController that is retrievable from Node*, V8 uses static chain of +// handlers (encapsulated as v8::TryCatch and here as ExceptionCatcher) +// to track exceptions, so it has no need for Node*. +ExceptionContext::ExceptionContext(Node* node) { } -ExceptionContext::~ExceptionContext() +ExceptionContext::ExceptionContext() + : m_exception() + , m_exceptionCatcher(0) { } @@ -60,16 +64,12 @@ bool ExceptionContext::hadException() return !m_exception.IsEmpty(); } -ExceptionContext* ExceptionContext::createFromNode(Node*) +JSException ExceptionContext::exception() const { - // Unlike JSC, which stores exceptions in ExecState that is accessible from - // ScriptController that is retrievable from Node*, V8 uses static chain of - // handlers (encapsulated as v8::TryCatch and here as ExceptionCatcher) - // to track exceptions, so it has no need for Node*. - return new ExceptionContext(); + return m_exception; } -JSException ExceptionContext::NoException() +JSException ExceptionContext::noException() { return v8::Local<v8::Value>(); } @@ -93,7 +93,7 @@ void ExceptionCatcher::updateContext() if (m_catcher.HasCaught()) m_context->setException(m_catcher.Exception()); else - m_context->setException(ExceptionContext::NoException()); + m_context->setException(ExceptionContext::noException()); } ExceptionCatcher::~ExceptionCatcher() |