Changeset 120791 in webkit
- Timestamp:
- Jun 19, 2012 8:27:27 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r120790 r120791 1 2012-06-19 Adam Klein <adamk@chromium.org> 2 3 Pass ScriptValue by const ref where possible 4 https://bugs.webkit.org/show_bug.cgi?id=89531 5 6 Reviewed by Kentaro Hara. 7 8 Previously ScriptValue was sometimes passed by value, sometimes by const ref. 9 10 For consistency and optimality, pass by const ref everywhere (except where 11 ScriptValue is returned from non-accessor methods). 12 13 No new tests, no change in behavior. 14 15 * bindings/js/ScriptFunctionCall.h: 16 (ScriptCallback): 17 * bindings/js/ScriptProfiler.cpp: 18 (WebCore::ScriptProfiler::getHeapObjectId): 19 * bindings/js/ScriptProfiler.h: 20 (ScriptProfiler): 21 * bindings/js/WorkerScriptController.cpp: 22 (WebCore::WorkerScriptController::setException): 23 * bindings/js/WorkerScriptController.h: 24 (WorkerScriptController): 25 * bindings/v8/ScriptFunctionCall.cpp: 26 (WebCore::ScriptCallback::ScriptCallback): 27 * bindings/v8/ScriptFunctionCall.h: 28 (ScriptCallback): 29 * bindings/v8/ScriptProfiler.cpp: 30 (WebCore::ScriptProfiler::getHeapObjectId): 31 (WebCore): 32 * bindings/v8/ScriptProfiler.h: 33 (ScriptProfiler): 34 * bindings/v8/ScriptValue.h: 35 (WebCore::ScriptValue::operator==): 36 (WebCore::ScriptValue::operator!=): 37 * bindings/v8/WorkerScriptController.cpp: 38 (WebCore::WorkerScriptController::setException): 39 * bindings/v8/WorkerScriptController.h: 40 (WorkerScriptController): 41 * css/MediaQueryListListener.h: 42 (WebCore::MediaQueryListListener::create): 43 (WebCore::MediaQueryListListener::MediaQueryListListener): 44 * dom/CustomEvent.cpp: 45 (WebCore::CustomEvent::initCustomEvent): 46 * dom/CustomEvent.h: 47 (CustomEvent): 48 (WebCore::CustomEvent::detail): 49 * dom/MessageEvent.h: 50 (WebCore::MessageEvent::dataAsScriptValue): 51 * dom/PopStateEvent.h: 52 (WebCore::PopStateEvent::state): 53 * inspector/InjectedScript.cpp: 54 (WebCore::InjectedScript::wrapObject): 55 * inspector/InjectedScript.h: 56 (InjectedScript): 57 1 58 2012-06-18 Philippe Normand <pnormand@igalia.com> 2 59 -
trunk/Source/WebCore/bindings/js/ScriptFunctionCall.cpp
r98203 r120791 192 192 } 193 193 194 ScriptCallback::ScriptCallback(ScriptState* state, ScriptValuefunction)194 ScriptCallback::ScriptCallback(ScriptState* state, const ScriptValue& function) 195 195 : ScriptCallArgumentHandler(state) 196 196 , m_function(function) -
trunk/Source/WebCore/bindings/js/ScriptFunctionCall.h
r95901 r120791 88 88 class ScriptCallback : public ScriptCallArgumentHandler { 89 89 public: 90 ScriptCallback(ScriptState*, ScriptValue);90 ScriptCallback(ScriptState*, const ScriptValue&); 91 91 92 92 ScriptValue call(); -
trunk/Source/WebCore/bindings/js/ScriptProfiler.cpp
r116768 r120791 52 52 } 53 53 54 unsigned ScriptProfiler::getHeapObjectId( ScriptValue)54 unsigned ScriptProfiler::getHeapObjectId(const ScriptValue&) 55 55 { 56 56 return 0; -
trunk/Source/WebCore/bindings/js/ScriptProfiler.h
r120589 r120791 57 57 static void collectGarbage(); 58 58 static ScriptObject objectByHeapObjectId(unsigned id); 59 static unsigned getHeapObjectId( ScriptValue);59 static unsigned getHeapObjectId(const ScriptValue&); 60 60 static void start(ScriptState* state, const String& title); 61 61 static void startForPage(Page*, const String& title); -
trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp
r115579 r120791 156 156 } 157 157 158 void WorkerScriptController::setException( ScriptValueexception)158 void WorkerScriptController::setException(const ScriptValue& exception) 159 159 { 160 160 throwError(m_workerContextWrapper->globalExec(), exception.jsValue()); -
trunk/Source/WebCore/bindings/js/WorkerScriptController.h
r110131 r120791 61 61 void evaluate(const ScriptSourceCode&, ScriptValue* exception); 62 62 63 void setException( ScriptValue);63 void setException(const ScriptValue&); 64 64 65 65 // Async request to terminate a JS run execution. Eventually causes termination -
trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp
r120709 r120791 178 178 } 179 179 180 ScriptCallback::ScriptCallback(ScriptState* state, ScriptValuefunction)180 ScriptCallback::ScriptCallback(ScriptState* state, const ScriptValue& function) 181 181 : ScriptCallArgumentHandler(state) 182 182 , m_function(function) -
trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.h
r95901 r120791 75 75 class ScriptCallback : public ScriptCallArgumentHandler { 76 76 public: 77 ScriptCallback(ScriptState*, ScriptValue);77 ScriptCallback(ScriptState*, const ScriptValue&); 78 78 79 79 ScriptValue call(); -
trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp
r120589 r120791 122 122 } 123 123 124 unsigned ScriptProfiler::getHeapObjectId( ScriptValuevalue)124 unsigned ScriptProfiler::getHeapObjectId(const ScriptValue& value) 125 125 { 126 126 v8::SnapshotObjectId id = v8::HeapProfiler::GetSnapshotObjectId(value.v8Value()); -
trunk/Source/WebCore/bindings/v8/ScriptProfiler.h
r120589 r120791 61 61 static void collectGarbage(); 62 62 static ScriptObject objectByHeapObjectId(unsigned id); 63 static unsigned getHeapObjectId( ScriptValue);63 static unsigned getHeapObjectId(const ScriptValue&); 64 64 static void start(ScriptState* state, const String& title); 65 65 static void startForPage(Page*, const String& title); -
trunk/Source/WebCore/bindings/v8/ScriptValue.h
r115381 r120791 100 100 } 101 101 102 bool operator==(const ScriptValue value) const102 bool operator==(const ScriptValue& value) const 103 103 { 104 104 return m_value == value.m_value; … … 115 115 } 116 116 117 bool operator!=(const ScriptValue value) const117 bool operator!=(const ScriptValue& value) const 118 118 { 119 119 return !operator==(value); -
trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp
r119777 r120791 138 138 } 139 139 140 void WorkerScriptController::setException( ScriptValueexception)140 void WorkerScriptController::setException(const ScriptValue& exception) 141 141 { 142 142 throwError(*exception.v8Value()); -
trunk/Source/WebCore/bindings/v8/WorkerScriptController.h
r110131 r120791 59 59 void evaluate(const ScriptSourceCode&, ScriptValue* exception); 60 60 61 void setException( ScriptValue);61 void setException(const ScriptValue&); 62 62 63 63 // Async request to terminate a future JS execution. Eventually causes termination -
trunk/Source/WebCore/css/MediaQueryListListener.h
r95901 r120791 35 35 class MediaQueryListListener : public RefCounted<MediaQueryListListener> { 36 36 public: 37 static PassRefPtr<MediaQueryListListener> create( ScriptValuevalue)37 static PassRefPtr<MediaQueryListListener> create(const ScriptValue& value) 38 38 { 39 39 if (!value.isFunction()) … … 46 46 47 47 private: 48 MediaQueryListListener( ScriptValuevalue) : m_value(value) { }48 MediaQueryListListener(const ScriptValue& value) : m_value(value) { } 49 49 50 50 ScriptValue m_value; -
trunk/Source/WebCore/dom/CustomEvent.cpp
r98044 r120791 50 50 } 51 51 52 void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, ScriptValuedetail)52 void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& detail) 53 53 { 54 54 if (dispatched()) -
trunk/Source/WebCore/dom/CustomEvent.h
r98044 r120791 52 52 } 53 53 54 void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, ScriptValuedetail);54 void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& detail); 55 55 56 56 virtual const AtomicString& interfaceName() const; 57 57 58 ScriptValuedetail() const { return m_detail; }58 const ScriptValue& detail() const { return m_detail; } 59 59 60 60 private: -
trunk/Source/WebCore/dom/MessageEvent.h
r101295 r120791 108 108 }; 109 109 DataType dataType() const { return m_dataType; } 110 ScriptValuedataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; }110 const ScriptValue& dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; } 111 111 SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get(); } 112 112 String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; } -
trunk/Source/WebCore/dom/PopStateEvent.h
r108596 r120791 50 50 51 51 SerializedScriptValue* serializedState() const { return m_serializedState.get(); } 52 ScriptValuestate() const { return m_state; }52 const ScriptValue& state() const { return m_state; } 53 53 History* history() const { return m_history.get(); } 54 54 -
trunk/Source/WebCore/inspector/InjectedScript.cpp
r120769 r120791 179 179 #endif 180 180 181 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject( ScriptValuevalue, const String& groupName) const181 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const ScriptValue& value, const String& groupName) const 182 182 { 183 183 ASSERT(!hasNoValue()); -
trunk/Source/WebCore/inspector/InjectedScript.h
r120769 r120791 86 86 #endif 87 87 88 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject( ScriptValue, const String& groupName) const;88 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const ScriptValue&, const String& groupName) const; 89 89 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapNode(Node*, const String& groupName); 90 90 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapSerializedObject(SerializedScriptValue*, const String& groupName) const;
Note: See TracChangeset
for help on using the changeset viewer.