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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h

Issue 2742553002: Avoid a separate heap allocation for DOMWrapperMap. (Closed)
Patch Set: Merge branch 'master' into dom-data-store-no-separate-alloc 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h b/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h
index 8b372cae97afd35f8b0ec46379b5dfb2c015b6bc..f1825983d3cfbdd350d95092a58f9afe7fc8f833 100644
--- a/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h
+++ b/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h
@@ -40,7 +40,7 @@
#include "v8/include/v8.h"
#include "wtf/Allocator.h"
#include "wtf/Noncopyable.h"
-#include "wtf/PtrUtil.h"
+#include "wtf/Optional.h"
#include "wtf/StackUtil.h"
#include "wtf/StdLibExtras.h"
@@ -52,11 +52,11 @@ class DOMDataStore {
public:
DOMDataStore(v8::Isolate* isolate, bool isMainWorld)
- : m_isMainWorld(isMainWorld),
- // We never use |m_wrapperMap| when it's the main world.
- m_wrapperMap(WTF::wrapUnique(
- isMainWorld ? nullptr
- : new DOMWrapperMap<ScriptWrappable>(isolate))) {}
+ : m_isMainWorld(isMainWorld) {
+ // We never use |m_wrapperMap| when it's the main world.
+ if (!isMainWorld)
+ m_wrapperMap.emplace(isolate);
+ }
static DOMDataStore& current(v8::Isolate* isolate) {
return DOMWrapperWorld::current(isolate).domDataStore();
@@ -169,7 +169,7 @@ class DOMDataStore {
}
bool m_isMainWorld;
- std::unique_ptr<DOMWrapperMap<ScriptWrappable>> m_wrapperMap;
+ WTF::Optional<DOMWrapperMap<ScriptWrappable>> m_wrapperMap;
};
template <>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698