summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-14 00:04:45 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-14 00:04:45 +0000
commit1fd6be4518f3620e7c41dfe91235121cddd62a8b (patch)
tree9ea45a23ba7aa9aba3984a1ac0f79b2f228f76de
parent7e39f11ef94e7270cfdaefe71b9604161aa4f390 (diff)
downloadchromium_src-1fd6be4518f3620e7c41dfe91235121cddd62a8b.zip
chromium_src-1fd6be4518f3620e7c41dfe91235121cddd62a8b.tar.gz
chromium_src-1fd6be4518f3620e7c41dfe91235121cddd62a8b.tar.bz2
Fix some types in ScriptController.h to be a bit less wonky. This was mbelshe's proposed method and I think it's sane and clsoer to upstream than what we have now, but I admit that I haven't thought carefully through all the fine points.
Review URL: http://codereview.chromium.org/7288 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3333 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--webkit/pending/ScriptController.h12
-rw-r--r--webkit/port/bridge/ScriptControllerKJS.cpp16
-rw-r--r--webkit/port/bridge/ScriptControllerV8.cpp6
4 files changed, 15 insertions, 21 deletions
diff --git a/DEPS b/DEPS
index 2c9fbb5..1b316f0 100644
--- a/DEPS
+++ b/DEPS
@@ -12,7 +12,7 @@ deps = {
"http://googletest.googlecode.com/svn/trunk@63",
"src/third_party/WebKit":
- "/trunk/deps/third_party/WebKit@3297",
+ "/trunk/deps/third_party/WebKit@3330",
"src/third_party/cygwin":
"/trunk/deps/third_party/cygwin@3248",
diff --git a/webkit/pending/ScriptController.h b/webkit/pending/ScriptController.h
index ecfe418..9b90e75 100644
--- a/webkit/pending/ScriptController.h
+++ b/webkit/pending/ScriptController.h
@@ -147,8 +147,8 @@ class Widget;
typedef HashMap<void*, RefPtr<KJS::Bindings::RootObject> > RootObjectMap;
typedef KJS::UString JSString;
typedef KJS::Bindings::Instance* JSInstance;
-typedef PassRefPtr<KJS::Bindings::Instance> JSInstanceReturnValue;
-typedef KJS::Bindings::Instance* JSPersistentInstance;
+typedef PassRefPtr<KJS::Bindings::Instance> JSInstanceHandle;
+typedef RefPtr<KJS::Bindings::Instance> JSPersistentInstance;
typedef KJS::JSValue* JSException;
typedef KJS::JSValue* JSResult;
#endif
@@ -156,7 +156,7 @@ typedef KJS::JSValue* JSResult;
#if USE(V8)
typedef String JSString;
typedef v8::Local<v8::Object> JSInstance;
-typedef v8::Local<v8::Object> JSInstanceReturnValue;
+typedef v8::Local<v8::Object> JSInstanceHandle;
typedef v8::Persistent<v8::Object> JSPersistentInstance;
typedef v8::Local<v8::Value> JSException;
typedef v8::Persistent<v8::Value> JSResult;
@@ -199,7 +199,7 @@ public:
NPRuntimeFunctions* functions();
- JSInstanceReturnValue createScriptInstanceForWidget(Widget*);
+ JSInstanceHandle createScriptInstanceForWidget(Widget*);
void clearPluginObjects();
void clearDocumentWrapper();
@@ -311,7 +311,7 @@ private:
class JSInstanceHolder {
public:
JSInstanceHolder();
- JSInstanceHolder(JSInstance);
+ JSInstanceHolder(JSInstanceHandle);
~JSInstanceHolder();
// Returns true if the holder is empty.
bool IsEmpty();
@@ -319,7 +319,7 @@ public:
JSInstance Get();
// Clear the contained JSInstance.
void Clear();
- JSInstanceHolder& operator=(JSInstance);
+ JSInstanceHolder& operator=(JSInstanceHandle);
static JSInstance EmptyInstance();
private:
diff --git a/webkit/port/bridge/ScriptControllerKJS.cpp b/webkit/port/bridge/ScriptControllerKJS.cpp
index 2ff7a04..f08c353 100644
--- a/webkit/port/bridge/ScriptControllerKJS.cpp
+++ b/webkit/port/bridge/ScriptControllerKJS.cpp
@@ -172,8 +172,8 @@ JSInstanceHolder::JSInstanceHolder() :
m_instance(0) {
}
-JSInstanceHolder::JSInstanceHolder(JSInstance instance) {
- *this = instance;
+JSInstanceHolder::JSInstanceHolder(JSInstanceHandle instance) {
+ m_instance = instance;
}
JSInstanceHolder::~JSInstanceHolder() {
@@ -185,25 +185,19 @@ bool JSInstanceHolder::IsEmpty() {
}
void JSInstanceHolder::Clear() {
- if (m_instance) {
- m_instance->deref();
- m_instance = 0;
- }
+ m_instance = 0;
}
JSInstance JSInstanceHolder::Get() {
- return m_instance;
+ return m_instance.get();
}
JSInstance JSInstanceHolder::EmptyInstance() {
return 0;
}
-JSInstanceHolder& JSInstanceHolder::operator=(JSInstance instance) {
- Clear();
+JSInstanceHolder& JSInstanceHolder::operator=(JSInstanceHandle instance) {
m_instance = instance;
- if (m_instance)
- m_instance->ref();
return *this;
}
diff --git a/webkit/port/bridge/ScriptControllerV8.cpp b/webkit/port/bridge/ScriptControllerV8.cpp
index 63f7aa3..fa751a7 100644
--- a/webkit/port/bridge/ScriptControllerV8.cpp
+++ b/webkit/port/bridge/ScriptControllerV8.cpp
@@ -373,7 +373,7 @@ bool ScriptController::isEnabled() const
return m_proxy->isEnabled();
}
-JSInstance ScriptController::createScriptInstanceForWidget(Widget* widget)
+JSInstanceHandle ScriptController::createScriptInstanceForWidget(Widget* widget)
{
ASSERT(widget != 0);
@@ -533,7 +533,7 @@ JSInstanceHolder::JSInstanceHolder()
{
}
-JSInstanceHolder::JSInstanceHolder(JSInstance instance)
+JSInstanceHolder::JSInstanceHolder(JSInstanceHandle instance)
{
*this = instance;
}
@@ -571,7 +571,7 @@ JSInstance JSInstanceHolder::EmptyInstance()
return v8::Local<v8::Object>();
}
-JSInstanceHolder& JSInstanceHolder::operator=(JSInstance instance)
+JSInstanceHolder& JSInstanceHolder::operator=(JSInstanceHandle instance)
{
Clear();
if (instance.IsEmpty())