Changeset 92643 in webkit


Ignore:
Timestamp:
Aug 8, 2011 3:17:46 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r92619.
http://trac.webkit.org/changeset/92619
https://bugs.webkit.org/show_bug.cgi?id=65881

This patch breaks chromium canary (Requested by jianli on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-08-08

Source/WebCore:

  • bindings/v8/V8Binding.h:
  • bindings/v8/V8GCController.cpp:

(WebCore::globalHandleMap):
(WebCore::enumerateGlobalHandles):
(WebCore::V8GCController::registerGlobalHandle):
(WebCore::V8GCController::unregisterGlobalHandle):

  • bindings/v8/V8HiddenPropertyName.cpp:

(WebCore::V8HiddenPropertyName::createString):

  • bindings/v8/V8HiddenPropertyName.h:
  • bindings/v8/V8LazyEventListener.cpp:

(WebCore::V8LazyEventListener::prepareListenerObject):

  • bindings/v8/V8NPObject.cpp:
  • bindings/v8/V8Proxy.cpp:

(WebCore::V8Proxy::checkNewLegal):

  • bindings/v8/V8Utilities.h:

(WebCore::AllowAllocation::AllowAllocation):
(WebCore::AllowAllocation::~AllowAllocation):
(WebCore::SafeAllocation::newInstance):

  • bindings/v8/WorkerContextExecutionProxy.cpp:

(WebCore::WorkerContextExecutionProxy::WorkerContextExecutionProxy):
(WebCore::WorkerContextExecutionProxy::initV8):

  • bindings/v8/WorkerContextExecutionProxy.h:
  • bindings/v8/WorkerScriptController.cpp:

(WebCore::WorkerScriptController::scheduleExecutionTermination):

Source/WebKit/chromium:

  • src/BoundObject.cpp:
Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r92639 r92643  
     12011-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
    1352011-08-08  Scott Byer  <scottbyer@chromium.org>
    236
  • trunk/Source/WebCore/bindings/v8/V8Binding.h

    r92619 r92643  
    3737#include "PlatformString.h"
    3838#include "V8DOMWrapper.h"
    39 #include "V8GCController.h"
    40 #include "V8HiddenPropertyName.h"
    4139#include <wtf/text/AtomicString.h>
    4240
     
    8886    };
    8987
    90     class AllowAllocation;
    91 
    92 #ifndef NDEBUG
    93     typedef HashMap<v8::Value*, GlobalHandleInfo*> GlobalHandleMap;
    94 #endif
    95 
    9688    class V8BindingPerIsolateData {
    9789    public:
     
    116108        v8::Persistent<v8::String>& toStringName() { return m_toStringName; }
    117109        v8::Persistent<v8::FunctionTemplate>& toStringTemplate() { return m_toStringTemplate; }
    118 
    119         v8::Persistent<v8::FunctionTemplate>& lazyEventListenerToStringTemplate()
    120         {
    121             return m_lazyEventListenerToStringTemplate;
    122         }
    123 
    124110        StringCache* stringCache() { return &m_stringCache; }
    125111
    126112        DOMDataList& allStores() { return m_domDataList; }
    127 
    128         V8HiddenPropertyName* hiddenPropertyName() { return &m_hiddenPropertyName; }
    129113
    130114        void registerDOMDataStore(DOMDataStore* domDataStore)
     
    143127        // DOMDataStore is owned outside V8BindingPerIsolateData.
    144128        void setDOMDataStore(DOMDataStore* store) { m_domDataStore = store; }
    145 
    146 #ifndef NDEBUG
    147         GlobalHandleMap& globalHandleMap() { return m_globalHandleMap; }
    148 #endif
    149129
    150130    private:
     
    156136        v8::Persistent<v8::String> m_toStringName;
    157137        v8::Persistent<v8::FunctionTemplate> m_toStringTemplate;
    158         v8::Persistent<v8::FunctionTemplate> m_lazyEventListenerToStringTemplate;
    159138        StringCache m_stringCache;
    160139
    161140        DOMDataList m_domDataList;
    162141        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    };
    226143
    227144
  • trunk/Source/WebCore/bindings/v8/V8GCController.cpp

    r92619 r92643  
    8282// #endif
    8383//
    84 
    85 static GlobalHandleMap& currentGlobalHandleMap()
    86 {
    87     return V8BindingPerIsolateData::current()->globalHandleMap();
     84typedef HashMap<v8::Value*, GlobalHandleInfo*> GlobalHandleMap;
     85
     86static GlobalHandleMap& globalHandleMap()
     87{
     88    DEFINE_STATIC_LOCAL(GlobalHandleMap, staticGlobalHandleMap, ());
     89    return staticGlobalHandleMap;
    8890}
    8991
     
    9294static void enumerateGlobalHandles()
    9395{
    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) {
    9697        GlobalHandleInfo* info = it->second;
    9798        UNUSED_PARAM(info);
     
    103104void V8GCController::registerGlobalHandle(GlobalHandleType type, void* host, v8::Persistent<v8::Value> handle)
    104105{
    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));
    108108}
    109109
    110110void V8GCController::unregisterGlobalHandle(void* host, v8::Persistent<v8::Value> handle)
    111111{
    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);
    115114    ASSERT(info->m_host == host);
    116115    delete info;
  • trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.cpp

    r92619 r92643  
    3232#include "V8HiddenPropertyName.h"
    3333
    34 #include "V8Binding.h"
    3534#include <string.h>
    3635#include <wtf/Vector.h>
     
    4443v8::Handle<v8::String> V8HiddenPropertyName::name() \
    4544{ \
    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; \
    5147}
    5248
     
    6460}
    6561
    66 v8::Persistent<v8::String> V8HiddenPropertyName::createString(const char* key)
     62v8::Persistent<v8::String>* V8HiddenPropertyName::createString(const char* key)
    6763{
    6864    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)));
    7066}
    7167
  • trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.h

    r92619 r92643  
    5656
    5757    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);
    6259    };
    6360
  • trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp

    r92619 r92643  
    138138            // other use. That fails miserably if the actual wrapper source is
    139139            // returned.
    140             v8::Persistent<v8::FunctionTemplate>& toStringTemplate =
    141                 V8BindingPerIsolateData::current()->lazyEventListenerToStringTemplate();
     140            DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, toStringTemplate, ());
    142141            if (toStringTemplate.IsEmpty())
    143142                toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8LazyEventListenerToString));
  • trunk/Source/WebCore/bindings/v8/V8NPObject.cpp

    r92619 r92643  
    3535#include "HTMLPlugInElement.h"
    3636#include "NPV8Object.h"
    37 #include "V8Binding.h"
    3837#include "V8DOMMap.h"
    3938#include "V8HTMLAppletElement.h"
  • trunk/Source/WebCore/bindings/v8/V8Proxy.cpp

    r92619 r92643  
    133133typedef HashMap<int, v8::FunctionTemplate*> FunctionTemplateMap;
    134134
     135bool AllowAllocation::m_current = false;
     136
    135137static void addMessageToConsole(Page* page, const String& message, const String& sourceID, unsigned lineNumber)
    136138{
     
    782784v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args)
    783785{
    784     if (!AllowAllocation::current())
     786    if (!AllowAllocation::m_current)
    785787        return throwError(TypeError, "Illegal constructor");
    786788
  • trunk/Source/WebCore/bindings/v8/V8Utilities.h

    r92619 r92643  
    9696    }
    9797
     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
    98148} // namespace WebCore
    99149
  • trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp

    r92619 r92643  
    8484    , m_recursion(0)
    8585{
    86     initIsolate();
     86    initV8();
    8787}
    8888
     
    109109}
    110110
    111 void WorkerContextExecutionProxy::initIsolate()
     111void WorkerContextExecutionProxy::initV8()
    112112{
    113113    // Tell V8 not to call the default OOM handler, binding code will handle it.
    114114    v8::V8::IgnoreOutOfMemoryException();
    115115    v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
    116 
    117     v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
    118     v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
    119116
    120117    v8::ResourceConstraints resource_constraints;
  • trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h

    r92619 r92643  
    7474
    7575    private:
    76         void initIsolate();
     76        void initV8();
    7777        bool initContextIfNeeded();
    7878        void dispose();
  • trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp

    r92619 r92643  
    9595void WorkerScriptController::scheduleExecutionTermination()
    9696{
    97     v8::V8::TerminateExecution(m_isolate);
     97    v8::V8::TerminateExecution();
    9898}
    9999
  • trunk/Source/WebKit/chromium/ChangeLog

    r92639 r92643  
     12011-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
    1122011-08-08  Scott Byer  <scottbyer@chromium.org>
    213
  • trunk/Source/WebKit/chromium/src/BoundObject.cpp

    r92619 r92643  
    3232#include "BoundObject.h"
    3333
    34 #include "V8Binding.h"
    3534#include "V8Proxy.h"
    3635
Note: See TracChangeset for help on using the changeset viewer.