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

Side by Side Diff: third_party/WebKit/WebCore/bridge/qt/qt_instance.cpp

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public 5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 void QtRuntimeObjectImp::removeFromCache() 92 void QtRuntimeObjectImp::removeFromCache()
93 { 93 {
94 JSLock lock(false); 94 JSLock lock(false);
95 QtInstance* key = cachedObjects.key(this); 95 QtInstance* key = cachedObjects.key(this);
96 if (key) 96 if (key)
97 cachedObjects.remove(key); 97 cachedObjects.remove(key);
98 } 98 }
99 99
100 // QtInstance 100 // QtInstance
101 QtInstance::QtInstance(QObject* o, PassRefPtr<RootObject> rootObject, QScriptEng ine::ValueOwnership ownership) 101 QtInstance::QtInstance(QObject* o, PassRefPtr<RootObject> rootObject)
102 : Instance(rootObject) 102 : Instance(rootObject)
103 , m_class(0) 103 , m_class(0)
104 , m_object(o) 104 , m_object(o)
105 , m_hashkey(o) 105 , m_hashkey(o)
106 , m_defaultMethod(0) 106 , m_defaultMethod(0)
107 , m_ownership(ownership)
108 { 107 {
109 } 108 }
110 109
111 QtInstance::~QtInstance() 110 QtInstance::~QtInstance()
112 { 111 {
113 JSLock lock(false); 112 JSLock lock(false);
114 113
115 cachedObjects.remove(this); 114 cachedObjects.remove(this);
116 cachedInstances.remove(m_hashkey); 115 cachedInstances.remove(m_hashkey);
117 116
118 // clean up (unprotect from gc) the JSValues we've created 117 // clean up (unprotect from gc) the JSValues we've created
119 m_methods.clear(); 118 m_methods.clear();
120 119
121 foreach(QtField* f, m_fields.values()) { 120 foreach(QtField* f, m_fields.values()) {
122 delete f; 121 delete f;
123 } 122 }
124 m_fields.clear(); 123 m_fields.clear();
125 124 }
126 if (m_object) { 125
127 switch (m_ownership) { 126 PassRefPtr<QtInstance> QtInstance::getQtInstance(QObject* o, PassRefPtr<RootObje ct> rootObject)
128 case QScriptEngine::QtOwnership:
129 break;
130 case QScriptEngine::AutoOwnership:
131 if (m_object->parent())
132 break;
133 // fall through!
134 case QScriptEngine::ScriptOwnership:
135 delete m_object;
136 break;
137 }
138 }
139 }
140
141 PassRefPtr<QtInstance> QtInstance::getQtInstance(QObject* o, PassRefPtr<RootObje ct> rootObject, QScriptEngine::ValueOwnership ownership)
142 { 127 {
143 JSLock lock(false); 128 JSLock lock(false);
144 129
145 foreach(QtInstance* instance, cachedInstances.values(o)) { 130 foreach(QtInstance* instance, cachedInstances.values(o)) {
146 if (instance->rootObject() == rootObject) 131 if (instance->rootObject() == rootObject)
147 return instance; 132 return instance;
148 } 133 }
149 134
150 RefPtr<QtInstance> ret = QtInstance::create(o, rootObject, ownership); 135 RefPtr<QtInstance> ret = QtInstance::create(o, rootObject);
151 cachedInstances.insert(o, ret.get()); 136 cachedInstances.insert(o, ret.get());
152 137
153 return ret.release(); 138 return ret.release();
154 } 139 }
155 140
156 bool QtInstance::getOwnPropertySlot(JSObject* object, ExecState* exec, const Ide ntifier& propertyName, PropertySlot& slot) 141 bool QtInstance::getOwnPropertySlot(JSObject* object, ExecState* exec, const Ide ntifier& propertyName, PropertySlot& slot)
157 { 142 {
158 return object->JSObject::getOwnPropertySlot(exec, propertyName, slot); 143 return object->JSObject::getOwnPropertySlot(exec, propertyName, slot);
159 } 144 }
160 145
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 obj->setProperty(m_dynamicProperty.constData(), val); 374 obj->setProperty(m_dynamicProperty.constData(), val);
390 } else { 375 } else {
391 QString msg = QString(QLatin1String("cannot access member `%1' of delete d QObject")).arg(QLatin1String(name())); 376 QString msg = QString(QLatin1String("cannot access member `%1' of delete d QObject")).arg(QLatin1String(name()));
392 throwError(exec, GeneralError, msg.toLatin1().constData()); 377 throwError(exec, GeneralError, msg.toLatin1().constData());
393 } 378 }
394 } 379 }
395 380
396 381
397 } 382 }
398 } 383 }
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/bridge/qt/qt_instance.h ('k') | third_party/WebKit/WebCore/bridge/qt/qt_runtime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698