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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h

Issue 2735823006: Bindings: Manage multiple DOMWrapperWorlds for worklets (Closed)
Patch Set: address review comments Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Per-thread global identifiers for DOMWrapperWorld. 54 // Per-thread global identifiers for DOMWrapperWorld.
55 enum WorldId { 55 enum WorldId {
56 InvalidWorldId = -1, 56 InvalidWorldId = -1,
57 MainWorldId = 0, 57 MainWorldId = 0,
58 58
59 // Embedder isolated worlds can use IDs in [1, 1<<29). 59 // Embedder isolated worlds can use IDs in [1, 1<<29).
60 EmbedderWorldIdLimit = (1 << 29), 60 EmbedderWorldIdLimit = (1 << 29),
61 DocumentXMLTreeViewerWorldId, 61 DocumentXMLTreeViewerWorldId,
62 IsolatedWorldIdLimit, 62 IsolatedWorldIdLimit,
63 63
64 // TODO(nhiroki): Dynamically allocate a world id for the following worlds 64 // Other worlds can use IDs after this. Don't manually pick up an ID from
65 // instead of a fixed value (https://crbug.com/697622). 65 // this range. generateWorldIdForType() picks it up on behalf of you.
66 GarbageCollectorWorldId, 66 UnspecifiedWorldIdStart,
67 RegExpWorldId,
68 TestingWorldId,
69 WorkerWorldId,
70 }; 67 };
71 68
72 enum class WorldType { 69 enum class WorldType {
73 Main, 70 Main,
74 Isolated, 71 Isolated,
75 GarbageCollector, 72 GarbageCollector,
76 RegExp, 73 RegExp,
77 Testing, 74 Testing,
78 Worker, 75 Worker,
79 }; 76 };
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 private: 139 private:
143 DOMWrapperWorld(v8::Isolate*, WorldType, int worldId); 140 DOMWrapperWorld(v8::Isolate*, WorldType, int worldId);
144 141
145 static void weakCallbackForDOMObjectHolder( 142 static void weakCallbackForDOMObjectHolder(
146 const v8::WeakCallbackInfo<DOMObjectHolderBase>&); 143 const v8::WeakCallbackInfo<DOMObjectHolderBase>&);
147 void registerDOMObjectHolderInternal(std::unique_ptr<DOMObjectHolderBase>); 144 void registerDOMObjectHolderInternal(std::unique_ptr<DOMObjectHolderBase>);
148 void unregisterDOMObjectHolder(DOMObjectHolderBase*); 145 void unregisterDOMObjectHolder(DOMObjectHolderBase*);
149 146
150 static unsigned s_numberOfNonMainWorldsInMainThread; 147 static unsigned s_numberOfNonMainWorldsInMainThread;
151 148
152 // Returns an identifier for a given world type. This must not call for 149 // Returns an identifier for a given world type. This must not be called for
153 // WorldType::IsolatedWorld because an identifier for the world is given from 150 // WorldType::IsolatedWorld because an identifier for the world is given from
154 // out of DOMWrapperWorld. 151 // out of DOMWrapperWorld.
155 static int getWorldIdForType(WorldType); 152 static int generateWorldIdForType(WorldType);
156 153
157 const WorldType m_worldType; 154 const WorldType m_worldType;
158 const int m_worldId; 155 const int m_worldId;
159 std::unique_ptr<DOMDataStore> m_domDataStore; 156 std::unique_ptr<DOMDataStore> m_domDataStore;
160 HashSet<std::unique_ptr<DOMObjectHolderBase>> m_domObjectHolders; 157 HashSet<std::unique_ptr<DOMObjectHolderBase>> m_domObjectHolders;
161 }; 158 };
162 159
163 } // namespace blink 160 } // namespace blink
164 161
165 #endif // DOMWrapperWorld_h 162 #endif // DOMWrapperWorld_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698