Changeset 126465 in webkit
- Timestamp:
- Aug 23, 2012 12:16:46 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126464 r126465 1 2012-08-23 Adam Barth <abarth@webkit.org> 2 3 [V8] V8ScriptInstance is much more complicated than necessary 4 https://bugs.webkit.org/show_bug.cgi?id=94785 5 6 Reviewed by Kentaro Hara. 7 8 V8ScriptInstance just needs to be a one-line wrapper around OwnHandle. 9 10 * bindings/v8/OwnHandle.h: 11 (WebCore::OwnHandle::get): 12 * bindings/v8/ScriptInstance.cpp: 13 (WebCore::V8ScriptInstance::V8ScriptInstance): 14 (WebCore::V8ScriptInstance::~V8ScriptInstance): 15 (WebCore::V8ScriptInstance::instance): 16 * bindings/v8/ScriptInstance.h: 17 (WebCore::V8ScriptInstance::create): 18 (V8ScriptInstance): 19 1 20 2012-08-23 Christophe Dumez <christophe.dumez@intel.com> 2 21 -
trunk/Source/WebCore/bindings/v8/OwnHandle.h
r126446 r126465 53 53 } 54 54 55 v8:: Handle<T> get() const { return m_handle; }55 v8::Persistent<T> get() const { return m_handle; } 56 56 57 57 void set(v8::Handle<T> handle) -
trunk/Source/WebCore/bindings/v8/ScriptInstance.cpp
r126407 r126465 32 32 #include "ScriptInstance.h" 33 33 34 #include "V8GCController.h"35 #include <wtf/Assertions.h>36 37 34 namespace WebCore { 38 35 39 V8ScriptInstance::V8ScriptInstance() 36 V8ScriptInstance::V8ScriptInstance(v8::Handle<v8::Object> instance) 37 : m_instance(instance) 40 38 { 41 39 } 42 40 43 V8ScriptInstance::V8ScriptInstance(v8::Handle<v8::Object> instance)44 {45 set(instance);46 }47 48 V8ScriptInstance::~V8ScriptInstance()49 {50 clear();51 }52 53 v8::Persistent<v8::Object> V8ScriptInstance::instance()54 {55 return m_instance;56 }57 58 void V8ScriptInstance::clear()59 {60 if (m_instance.IsEmpty())61 return;62 #ifndef NDEBUG63 V8GCController::unregisterGlobalHandle(this, m_instance);64 #endif65 m_instance.Dispose();66 m_instance.Clear();67 }68 69 void V8ScriptInstance::set(v8::Handle<v8::Object> instance)70 {71 clear();72 if (instance.IsEmpty())73 return;74 75 m_instance = v8::Persistent<v8::Object>::New(instance);76 #ifndef NDEBUG77 V8GCController::registerGlobalHandle(SCRIPTINSTANCE, this, m_instance);78 #endif79 }80 81 41 } // namespace WebCore -
trunk/Source/WebCore/bindings/v8/ScriptInstance.h
r95901 r126465 32 32 #define ScriptInstance_h 33 33 34 #include "OwnHandle.h" 34 35 #include <v8.h> 35 36 36 #include <wtf/PassRefPtr.h> 37 37 #include <wtf/RefCounted.h> … … 42 42 class V8ScriptInstance : public RefCounted<V8ScriptInstance> { 43 43 public: 44 static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) 45 { 46 return adoptRef(new V8ScriptInstance(instance)); 47 } 48 V8ScriptInstance(); 49 V8ScriptInstance(v8::Handle<v8::Object>); 50 ~V8ScriptInstance(); 51 v8::Persistent<v8::Object> instance(); 44 static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) { return adoptRef(new V8ScriptInstance(instance)); } 45 46 v8::Persistent<v8::Object> instance() { return m_instance.get(); } 52 47 53 48 private: 54 void clear();55 void set(v8::Handle<v8::Object>); 56 mutable v8::Persistent<v8::Object> m_instance;49 explicit V8ScriptInstance(v8::Handle<v8::Object>); 50 51 OwnHandle<v8::Object> m_instance; 57 52 }; 58 53
Note: See TracChangeset
for help on using the changeset viewer.