| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef V8PerIsolateData_h | 26 #ifndef V8PerIsolateData_h |
| 27 #define V8PerIsolateData_h | 27 #define V8PerIsolateData_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScopedPersistent.h" | 29 #include "bindings/core/v8/ScopedPersistent.h" |
| 30 #include "bindings/core/v8/ScriptState.h" | 30 #include "bindings/core/v8/ScriptState.h" |
| 31 #include "bindings/core/v8/V8HiddenValue.h" | 31 #include "bindings/core/v8/V8HiddenValue.h" |
| 32 #include "bindings/core/v8/WrapperTypeInfo.h" | 32 #include "bindings/core/v8/WrapperTypeInfo.h" |
| 33 #include "gin/public/isolate_holder.h" | 33 #include "gin/public/isolate_holder.h" |
| 34 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" | |
| 35 #include "wtf/HashMap.h" | 34 #include "wtf/HashMap.h" |
| 36 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
| 38 #include <v8.h> | 37 #include <v8.h> |
| 39 | 38 |
| 40 namespace blink { | 39 namespace blink { |
| 41 | 40 |
| 42 class DOMDataStore; | 41 class DOMDataStore; |
| 43 class GCEventData; | 42 class GCEventData; |
| 44 class StringCache; | 43 class StringCache; |
| 45 struct WrapperTypeInfo; | 44 struct WrapperTypeInfo; |
| 46 | 45 |
| 47 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; | 46 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; |
| 48 | 47 |
| 49 class V8PerIsolateData { | 48 class V8PerIsolateData { |
| 50 public: | 49 public: |
| 50 class EndOfScopeTask { |
| 51 public: |
| 52 virtual ~EndOfScopeTask() { } |
| 53 virtual void Run() = 0; |
| 54 }; |
| 55 |
| 51 static v8::Isolate* initialize(); | 56 static v8::Isolate* initialize(); |
| 52 static V8PerIsolateData* from(v8::Isolate* isolate) | 57 static V8PerIsolateData* from(v8::Isolate* isolate) |
| 53 { | 58 { |
| 54 ASSERT(isolate); | 59 ASSERT(isolate); |
| 55 ASSERT(isolate->GetData(gin::kEmbedderBlink)); | 60 ASSERT(isolate->GetData(gin::kEmbedderBlink)); |
| 56 return static_cast<V8PerIsolateData*>(isolate->GetData(gin::kEmbedderBli
nk)); | 61 return static_cast<V8PerIsolateData*>(isolate->GetData(gin::kEmbedderBli
nk)); |
| 57 } | 62 } |
| 58 | 63 |
| 59 static void willBeDestroyed(v8::Isolate*); | 64 static void willBeDestroyed(v8::Isolate*); |
| 60 static void destroy(v8::Isolate*); | 65 static void destroy(v8::Isolate*); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void setDOMTemplate(void* domTemplateKey, v8::Handle<v8::FunctionTemplate>); | 100 void setDOMTemplate(void* domTemplateKey, v8::Handle<v8::FunctionTemplate>); |
| 96 | 101 |
| 97 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>); | 102 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>); |
| 98 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
v8::Handle<v8::Value>); | 103 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
v8::Handle<v8::Value>); |
| 99 | 104 |
| 100 v8::Local<v8::Context> ensureScriptRegexpContext(); | 105 v8::Local<v8::Context> ensureScriptRegexpContext(); |
| 101 | 106 |
| 102 const char* previousSamplingState() const { return m_previousSamplingState;
} | 107 const char* previousSamplingState() const { return m_previousSamplingState;
} |
| 103 void setPreviousSamplingState(const char* name) { m_previousSamplingState =
name; } | 108 void setPreviousSamplingState(const char* name) { m_previousSamplingState =
name; } |
| 104 | 109 |
| 105 IDBPendingTransactionMonitor* ensureIDBPendingTransactionMonitor(); | 110 void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); |
| 111 void runEndOfScopeTasks(); |
| 112 void clearEndOfScopeTasks(); |
| 106 | 113 |
| 107 private: | 114 private: |
| 108 V8PerIsolateData(); | 115 V8PerIsolateData(); |
| 109 ~V8PerIsolateData(); | 116 ~V8PerIsolateData(); |
| 110 | 117 |
| 111 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate> > DOMTemplate
Map; | 118 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate> > DOMTemplate
Map; |
| 112 DOMTemplateMap& currentDOMTemplateMap(); | 119 DOMTemplateMap& currentDOMTemplateMap(); |
| 113 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateM
ap&); | 120 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateM
ap&); |
| 114 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
v8::Handle<v8::Value>, DOMTemplateMap&); | 121 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
v8::Handle<v8::Value>, DOMTemplateMap&); |
| 115 | 122 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 131 int m_recursionLevel; | 138 int m_recursionLevel; |
| 132 bool m_isHandlingRecursionLevelError; | 139 bool m_isHandlingRecursionLevelError; |
| 133 bool m_isReportingException; | 140 bool m_isReportingException; |
| 134 | 141 |
| 135 #if ENABLE(ASSERT) | 142 #if ENABLE(ASSERT) |
| 136 int m_internalScriptRecursionLevel; | 143 int m_internalScriptRecursionLevel; |
| 137 #endif | 144 #endif |
| 138 OwnPtr<GCEventData> m_gcEventData; | 145 OwnPtr<GCEventData> m_gcEventData; |
| 139 bool m_performingMicrotaskCheckpoint; | 146 bool m_performingMicrotaskCheckpoint; |
| 140 | 147 |
| 141 OwnPtr<IDBPendingTransactionMonitor> m_idbPendingTransactionMonitor; | 148 Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks; |
| 142 }; | 149 }; |
| 143 | 150 |
| 144 } // namespace blink | 151 } // namespace blink |
| 145 | 152 |
| 146 #endif // V8PerIsolateData_h | 153 #endif // V8PerIsolateData_h |
| OLD | NEW |