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

Side by Side Diff: third_party/WebKit/Source/platform/bindings/V8PerContextData.h

Issue 2843603002: Move ScriptWrappable and dependencies to platform/bindings (Closed)
Patch Set: Rebase and try again Created 3 years, 7 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef V8PerContextData_h 31 #ifndef V8PerContextData_h
32 #define V8PerContextData_h 32 #define V8PerContextData_h
33 33
34 #include <memory> 34 #include <memory>
35 35
36 #include "bindings/core/v8/ScopedPersistent.h"
37 #include "bindings/core/v8/V0CustomElementBinding.h"
38 #include "bindings/core/v8/V8GlobalValueMap.h"
39 #include "bindings/core/v8/WrapperTypeInfo.h"
40 #include "core/CoreExport.h"
41 #include "gin/public/context_holder.h" 36 #include "gin/public/context_holder.h"
42 #include "gin/public/gin_embedders.h" 37 #include "gin/public/gin_embedders.h"
38 #include "platform/PlatformExport.h"
39 #include "platform/bindings/ScopedPersistent.h"
40 #include "platform/bindings/V0CustomElementBinding.h"
41 #include "platform/bindings/V8GlobalValueMap.h"
42 #include "platform/bindings/WrapperTypeInfo.h"
43 #include "platform/wtf/Allocator.h" 43 #include "platform/wtf/Allocator.h"
44 #include "platform/wtf/HashMap.h" 44 #include "platform/wtf/HashMap.h"
45 #include "platform/wtf/Vector.h" 45 #include "platform/wtf/Vector.h"
46 #include "platform/wtf/text/AtomicString.h" 46 #include "platform/wtf/text/AtomicString.h"
47 #include "platform/wtf/text/AtomicStringHash.h" 47 #include "platform/wtf/text/AtomicStringHash.h"
48 #include "v8/include/v8.h" 48 #include "v8/include/v8.h"
49 49
50 namespace blink { 50 namespace blink {
51 51
52 class V8DOMActivityLogger; 52 class V8DOMActivityLogger;
53 class V8PerContextData; 53 class V8PerContextData;
54 54
55 enum V8ContextEmbedderDataField { 55 enum V8ContextEmbedderDataField {
56 kV8ContextPerContextDataIndex = 56 kV8ContextPerContextDataIndex = static_cast<int>(
57 static_cast<int>(gin::kPerContextDataStartIndex + gin::kEmbedderBlink), 57 gin::kPerContextDataStartIndex + // NOLINT(readability/enum_casing)
58 gin::kEmbedderBlink), // NOLINT(readability/enum_casing)
58 }; 59 };
59 60
60 class CORE_EXPORT V8PerContextData final { 61 class PLATFORM_EXPORT V8PerContextData final {
61 USING_FAST_MALLOC(V8PerContextData); 62 USING_FAST_MALLOC(V8PerContextData);
62 WTF_MAKE_NONCOPYABLE(V8PerContextData); 63 WTF_MAKE_NONCOPYABLE(V8PerContextData);
63 64
64 public: 65 public:
65 static std::unique_ptr<V8PerContextData> Create(v8::Local<v8::Context>); 66 static std::unique_ptr<V8PerContextData> Create(v8::Local<v8::Context>);
66 67
67 static V8PerContextData* From(v8::Local<v8::Context>); 68 static V8PerContextData* From(v8::Local<v8::Context>);
68 69
69 ~V8PerContextData(); 70 ~V8PerContextData();
70 71
(...skipping 28 matching lines...) Expand all
99 void AddCustomElementBinding(std::unique_ptr<V0CustomElementBinding>); 100 void AddCustomElementBinding(std::unique_ptr<V0CustomElementBinding>);
100 101
101 V8DOMActivityLogger* ActivityLogger() const { return activity_logger_; } 102 V8DOMActivityLogger* ActivityLogger() const { return activity_logger_; }
102 void SetActivityLogger(V8DOMActivityLogger* activity_logger) { 103 void SetActivityLogger(V8DOMActivityLogger* activity_logger) {
103 activity_logger_ = activity_logger; 104 activity_logger_ = activity_logger;
104 } 105 }
105 106
106 // Garbage collected classes that use V8PerContextData to hold an instance 107 // Garbage collected classes that use V8PerContextData to hold an instance
107 // should subclass Data, and use addData / clearData / getData to manage the 108 // should subclass Data, and use addData / clearData / getData to manage the
108 // instance. 109 // instance.
109 class CORE_EXPORT Data : public GarbageCollectedMixin {}; 110 class PLATFORM_EXPORT Data : public GarbageCollectedMixin {};
110 111
111 void AddData(const char* key, Data*); 112 void AddData(const char* key, Data*);
112 void ClearData(const char* key); 113 void ClearData(const char* key);
113 Data* GetData(const char* key); 114 Data* GetData(const char* key);
114 115
115 private: 116 private:
116 V8PerContextData(v8::Local<v8::Context>); 117 V8PerContextData(v8::Local<v8::Context>);
117 118
118 v8::Local<v8::Object> CreateWrapperFromCacheSlowCase(const WrapperTypeInfo*); 119 v8::Local<v8::Object> CreateWrapperFromCacheSlowCase(const WrapperTypeInfo*);
119 v8::Local<v8::Function> ConstructorForTypeSlowCase(const WrapperTypeInfo*); 120 v8::Local<v8::Function> ConstructorForTypeSlowCase(const WrapperTypeInfo*);
(...skipping 22 matching lines...) Expand all
142 // This is owned by a static hash map in V8DOMActivityLogger. 143 // This is owned by a static hash map in V8DOMActivityLogger.
143 V8DOMActivityLogger* activity_logger_; 144 V8DOMActivityLogger* activity_logger_;
144 145
145 using DataMap = PersistentHeapHashMap<const char*, Member<Data>>; 146 using DataMap = PersistentHeapHashMap<const char*, Member<Data>>;
146 DataMap data_map_; 147 DataMap data_map_;
147 }; 148 };
148 149
149 } // namespace blink 150 } // namespace blink
150 151
151 #endif // V8PerContextData_h 152 #endif // V8PerContextData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698