Changeset 92643 in webkit
- Timestamp:
- Aug 8, 2011 3:17:46 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r92639 r92643 1 2011-08-08 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r92619. 4 http://trac.webkit.org/changeset/92619 5 https://bugs.webkit.org/show_bug.cgi?id=65881 6 7 This patch breaks chromium canary (Requested by jianli on 8 #webkit). 9 10 * bindings/v8/V8Binding.h: 11 * bindings/v8/V8GCController.cpp: 12 (WebCore::globalHandleMap): 13 (WebCore::enumerateGlobalHandles): 14 (WebCore::V8GCController::registerGlobalHandle): 15 (WebCore::V8GCController::unregisterGlobalHandle): 16 * bindings/v8/V8HiddenPropertyName.cpp: 17 (WebCore::V8HiddenPropertyName::createString): 18 * bindings/v8/V8HiddenPropertyName.h: 19 * bindings/v8/V8LazyEventListener.cpp: 20 (WebCore::V8LazyEventListener::prepareListenerObject): 21 * bindings/v8/V8NPObject.cpp: 22 * bindings/v8/V8Proxy.cpp: 23 (WebCore::V8Proxy::checkNewLegal): 24 * bindings/v8/V8Utilities.h: 25 (WebCore::AllowAllocation::AllowAllocation): 26 (WebCore::AllowAllocation::~AllowAllocation): 27 (WebCore::SafeAllocation::newInstance): 28 * bindings/v8/WorkerContextExecutionProxy.cpp: 29 (WebCore::WorkerContextExecutionProxy::WorkerContextExecutionProxy): 30 (WebCore::WorkerContextExecutionProxy::initV8): 31 * bindings/v8/WorkerContextExecutionProxy.h: 32 * bindings/v8/WorkerScriptController.cpp: 33 (WebCore::WorkerScriptController::scheduleExecutionTermination): 34 1 35 2011-08-08 Scott Byer <scottbyer@chromium.org> 2 36 -
trunk/Source/WebCore/bindings/v8/V8Binding.h
r92619 r92643 37 37 #include "PlatformString.h" 38 38 #include "V8DOMWrapper.h" 39 #include "V8GCController.h"40 #include "V8HiddenPropertyName.h"41 39 #include <wtf/text/AtomicString.h> 42 40 … … 88 86 }; 89 87 90 class AllowAllocation;91 92 #ifndef NDEBUG93 typedef HashMap<v8::Value*, GlobalHandleInfo*> GlobalHandleMap;94 #endif95 96 88 class V8BindingPerIsolateData { 97 89 public: … … 116 108 v8::Persistent<v8::String>& toStringName() { return m_toStringName; } 117 109 v8::Persistent<v8::FunctionTemplate>& toStringTemplate() { return m_toStringTemplate; } 118 119 v8::Persistent<v8::FunctionTemplate>& lazyEventListenerToStringTemplate()120 {121 return m_lazyEventListenerToStringTemplate;122 }123 124 110 StringCache* stringCache() { return &m_stringCache; } 125 111 126 112 DOMDataList& allStores() { return m_domDataList; } 127 128 V8HiddenPropertyName* hiddenPropertyName() { return &m_hiddenPropertyName; }129 113 130 114 void registerDOMDataStore(DOMDataStore* domDataStore) … … 143 127 // DOMDataStore is owned outside V8BindingPerIsolateData. 144 128 void setDOMDataStore(DOMDataStore* store) { m_domDataStore = store; } 145 146 #ifndef NDEBUG147 GlobalHandleMap& globalHandleMap() { return m_globalHandleMap; }148 #endif149 129 150 130 private: … … 156 136 v8::Persistent<v8::String> m_toStringName; 157 137 v8::Persistent<v8::FunctionTemplate> m_toStringTemplate; 158 v8::Persistent<v8::FunctionTemplate> m_lazyEventListenerToStringTemplate;159 138 StringCache m_stringCache; 160 139 161 140 DOMDataList m_domDataList; 162 141 DOMDataStore* m_domDataStore; 163 164 V8HiddenPropertyName m_hiddenPropertyName; 165 166 bool m_currentAllocationsAllowed; 167 friend class AllowAllocation; 168 169 #ifndef NDEBUG 170 GlobalHandleMap m_globalHandleMap; 171 #endif 172 }; 173 174 class AllowAllocation { 175 public: 176 AllowAllocation() 177 { 178 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); 179 m_previous = data->m_currentAllocationsAllowed; 180 data->m_currentAllocationsAllowed = true; 181 } 182 183 ~AllowAllocation() 184 { 185 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); 186 data->m_currentAllocationsAllowed = m_previous; 187 } 188 189 static bool current() { return V8BindingPerIsolateData::current()->m_currentAllocationsAllowed; } 190 191 private: 192 bool m_previous; 193 }; 194 195 class SafeAllocation { 196 public: 197 static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>); 198 static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::ObjectTemplate>); 199 static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]); 200 }; 201 202 v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function) 203 { 204 if (function.IsEmpty()) 205 return v8::Local<v8::Object>(); 206 AllowAllocation allow; 207 return function->NewInstance(); 208 } 209 210 v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::ObjectTemplate> objectTemplate) 211 { 212 if (objectTemplate.IsEmpty()) 213 return v8::Local<v8::Object>(); 214 AllowAllocation allow; 215 return objectTemplate->NewInstance(); 216 } 217 218 v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[]) 219 { 220 if (function.IsEmpty()) 221 return v8::Local<v8::Object>(); 222 AllowAllocation allow; 223 return function->NewInstance(argc, argv); 224 } 225 142 }; 226 143 227 144 -
trunk/Source/WebCore/bindings/v8/V8GCController.cpp
r92619 r92643 82 82 // #endif 83 83 // 84 85 static GlobalHandleMap& currentGlobalHandleMap() 86 { 87 return V8BindingPerIsolateData::current()->globalHandleMap(); 84 typedef HashMap<v8::Value*, GlobalHandleInfo*> GlobalHandleMap; 85 86 static GlobalHandleMap& globalHandleMap() 87 { 88 DEFINE_STATIC_LOCAL(GlobalHandleMap, staticGlobalHandleMap, ()); 89 return staticGlobalHandleMap; 88 90 } 89 91 … … 92 94 static void enumerateGlobalHandles() 93 95 { 94 GlobalHandleMap& globalHandleMap = currentGlobalHandleMap(); 95 for (GlobalHandleMap::iterator it = globalHandleMap.begin(), end = globalHandleMap.end(); it != end; ++it) { 96 for (GlobalHandleMap::iterator it = globalHandleMap().begin(), end = globalHandleMap().end(); it != end; ++it) { 96 97 GlobalHandleInfo* info = it->second; 97 98 UNUSED_PARAM(info); … … 103 104 void V8GCController::registerGlobalHandle(GlobalHandleType type, void* host, v8::Persistent<v8::Value> handle) 104 105 { 105 GlobalHandleMap& globalHandleMap = currentGlobalHandleMap(); 106 ASSERT(!globalHandleMap.contains(*handle)); 107 globalHandleMap.set(*handle, new GlobalHandleInfo(host, type)); 106 ASSERT(!globalHandleMap().contains(*handle)); 107 globalHandleMap().set(*handle, new GlobalHandleInfo(host, type)); 108 108 } 109 109 110 110 void V8GCController::unregisterGlobalHandle(void* host, v8::Persistent<v8::Value> handle) 111 111 { 112 GlobalHandleMap& globalHandleMap = currentGlobalHandleMap(); 113 ASSERT(globalHandleMap.contains(*handle)); 114 GlobalHandleInfo* info = globalHandleMap.take(*handle); 112 ASSERT(globalHandleMap().contains(*handle)); 113 GlobalHandleInfo* info = globalHandleMap().take(*handle); 115 114 ASSERT(info->m_host == host); 116 115 delete info; -
trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.cpp
r92619 r92643 32 32 #include "V8HiddenPropertyName.h" 33 33 34 #include "V8Binding.h"35 34 #include <string.h> 36 35 #include <wtf/Vector.h> … … 44 43 v8::Handle<v8::String> V8HiddenPropertyName::name() \ 45 44 { \ 46 V8HiddenPropertyName* hiddenPropertyName = V8BindingPerIsolateData::current()->hiddenPropertyName(); \ 47 if (hiddenPropertyName->m_##name.IsEmpty()) { \ 48 hiddenPropertyName->m_##name = createString("WebCore::HiddenProperty::" V8_AS_STRING(name)); \ 49 } \ 50 return hiddenPropertyName->m_##name; \ 45 static v8::Persistent<v8::String>* string = createString("WebCore::HiddenProperty::" V8_AS_STRING(name)); \ 46 return *string; \ 51 47 } 52 48 … … 64 60 } 65 61 66 v8::Persistent<v8::String> V8HiddenPropertyName::createString(const char* key)62 v8::Persistent<v8::String>* V8HiddenPropertyName::createString(const char* key) 67 63 { 68 64 v8::HandleScope scope; 69 return v8::Persistent<v8::String>::New(v8::String::NewSymbol(key));65 return new v8::Persistent<v8::String>(v8::Persistent<v8::String>::New(v8::String::NewSymbol(key))); 70 66 } 71 67 -
trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.h
r92619 r92643 56 56 57 57 private: 58 static v8::Persistent<v8::String> createString(const char* key); 59 #define V8_DECLARE_FIELD(name) v8::Persistent<v8::String> m_##name; 60 V8_HIDDEN_PROPERTIES(V8_DECLARE_FIELD); 61 #undef V8_DECLARE_FIELD 58 static v8::Persistent<v8::String>* createString(const char* key); 62 59 }; 63 60 -
trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp
r92619 r92643 138 138 // other use. That fails miserably if the actual wrapper source is 139 139 // returned. 140 v8::Persistent<v8::FunctionTemplate>& toStringTemplate = 141 V8BindingPerIsolateData::current()->lazyEventListenerToStringTemplate(); 140 DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, toStringTemplate, ()); 142 141 if (toStringTemplate.IsEmpty()) 143 142 toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8LazyEventListenerToString)); -
trunk/Source/WebCore/bindings/v8/V8NPObject.cpp
r92619 r92643 35 35 #include "HTMLPlugInElement.h" 36 36 #include "NPV8Object.h" 37 #include "V8Binding.h"38 37 #include "V8DOMMap.h" 39 38 #include "V8HTMLAppletElement.h" -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r92619 r92643 133 133 typedef HashMap<int, v8::FunctionTemplate*> FunctionTemplateMap; 134 134 135 bool AllowAllocation::m_current = false; 136 135 137 static void addMessageToConsole(Page* page, const String& message, const String& sourceID, unsigned lineNumber) 136 138 { … … 782 784 v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args) 783 785 { 784 if (!AllowAllocation:: current())786 if (!AllowAllocation::m_current) 785 787 return throwError(TypeError, "Illegal constructor"); 786 788 -
trunk/Source/WebCore/bindings/v8/V8Utilities.h
r92619 r92643 96 96 } 97 97 98 class AllowAllocation { 99 public: 100 inline AllowAllocation() 101 { 102 m_previous = m_current; 103 m_current = true; 104 } 105 106 inline ~AllowAllocation() 107 { 108 m_current = m_previous; 109 } 110 111 static bool m_current; 112 113 private: 114 bool m_previous; 115 }; 116 117 class SafeAllocation { 118 public: 119 static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>); 120 static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::ObjectTemplate>); 121 static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]); 122 }; 123 124 v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function) 125 { 126 if (function.IsEmpty()) 127 return v8::Local<v8::Object>(); 128 AllowAllocation allow; 129 return function->NewInstance(); 130 } 131 132 v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::ObjectTemplate> objectTemplate) 133 { 134 if (objectTemplate.IsEmpty()) 135 return v8::Local<v8::Object>(); 136 AllowAllocation allow; 137 return objectTemplate->NewInstance(); 138 } 139 140 v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[]) 141 { 142 if (function.IsEmpty()) 143 return v8::Local<v8::Object>(); 144 AllowAllocation allow; 145 return function->NewInstance(argc, argv); 146 } 147 98 148 } // namespace WebCore 99 149 -
trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
r92619 r92643 84 84 , m_recursion(0) 85 85 { 86 init Isolate();86 initV8(); 87 87 } 88 88 … … 109 109 } 110 110 111 void WorkerContextExecutionProxy::init Isolate()111 void WorkerContextExecutionProxy::initV8() 112 112 { 113 113 // Tell V8 not to call the default OOM handler, binding code will handle it. 114 114 v8::V8::IgnoreOutOfMemoryException(); 115 115 v8::V8::SetFatalErrorHandler(reportFatalErrorInV8); 116 117 v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);118 v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);119 116 120 117 v8::ResourceConstraints resource_constraints; -
trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h
r92619 r92643 74 74 75 75 private: 76 void init Isolate();76 void initV8(); 77 77 bool initContextIfNeeded(); 78 78 void dispose(); -
trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp
r92619 r92643 95 95 void WorkerScriptController::scheduleExecutionTermination() 96 96 { 97 v8::V8::TerminateExecution( m_isolate);97 v8::V8::TerminateExecution(); 98 98 } 99 99 -
trunk/Source/WebKit/chromium/ChangeLog
r92639 r92643 1 2011-08-08 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r92619. 4 http://trac.webkit.org/changeset/92619 5 https://bugs.webkit.org/show_bug.cgi?id=65881 6 7 This patch breaks chromium canary (Requested by jianli on 8 #webkit). 9 10 * src/BoundObject.cpp: 11 1 12 2011-08-08 Scott Byer <scottbyer@chromium.org> 2 13 -
trunk/Source/WebKit/chromium/src/BoundObject.cpp
r92619 r92643 32 32 #include "BoundObject.h" 33 33 34 #include "V8Binding.h"35 34 #include "V8Proxy.h" 36 35
Note: See TracChangeset
for help on using the changeset viewer.