Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: Source/bindings/core/v8/V8PerIsolateData.h

Issue 686153003: Replace IDBPendingTransactionMonitor with end-of-recursion-scope tasks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review feedback Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 // EndOfScopeTasks are run by V8RecursionScope when control is returning
111 // to C++ from script, after executing a script task (e.g. callback,
112 // event) or microtasks (e.g. promise). This is explicitly needed for
113 // Indexed DB transactions per spec, but should in general be avoided.
114 void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>);
115 void runEndOfScopeTasks();
116 void clearEndOfScopeTasks();
106 117
107 private: 118 private:
108 V8PerIsolateData(); 119 V8PerIsolateData();
109 ~V8PerIsolateData(); 120 ~V8PerIsolateData();
110 121
111 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate> > DOMTemplate Map; 122 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate> > DOMTemplate Map;
112 DOMTemplateMap& currentDOMTemplateMap(); 123 DOMTemplateMap& currentDOMTemplateMap();
113 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateM ap&); 124 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateM ap&);
114 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateMap&); 125 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateMap&);
115 126
(...skipping 15 matching lines...) Expand all
131 int m_recursionLevel; 142 int m_recursionLevel;
132 bool m_isHandlingRecursionLevelError; 143 bool m_isHandlingRecursionLevelError;
133 bool m_isReportingException; 144 bool m_isReportingException;
134 145
135 #if ENABLE(ASSERT) 146 #if ENABLE(ASSERT)
136 int m_internalScriptRecursionLevel; 147 int m_internalScriptRecursionLevel;
137 #endif 148 #endif
138 OwnPtr<GCEventData> m_gcEventData; 149 OwnPtr<GCEventData> m_gcEventData;
139 bool m_performingMicrotaskCheckpoint; 150 bool m_performingMicrotaskCheckpoint;
140 151
141 OwnPtr<IDBPendingTransactionMonitor> m_idbPendingTransactionMonitor; 152 Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks;
142 }; 153 };
143 154
144 } // namespace blink 155 } // namespace blink
145 156
146 #endif // V8PerIsolateData_h 157 #endif // V8PerIsolateData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698