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

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

Issue 2335203006: Add [CachedAccessor] attribute to cache (almost) constant accessors (window.document). (Closed)
Patch Set: Pre-review nits Created 4 years, 3 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
Index: third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
index 0765d0248a94b16ec8c1df89d0ba7088962a4463..1e92c59e30e9f5ff27589d7270de8a41624c5875 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
@@ -40,6 +40,7 @@
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
#include "wtf/text/AtomicString.h"
+#include <map>
#include <v8.h>
namespace blink {
@@ -85,6 +86,15 @@ public:
DOMWrapperWorld& world() { return *m_world; }
+ // Global map, 'name' -> private property for all cached accessors.
+ typedef std::map<std::string, v8::Eternal<v8::Private>> StringPrivateMap;
+ static StringPrivateMap& cachedAccessors()
+ {
+ DCHECK(isMainThread());
jochen (gone - plz use gerrit) 2016/09/15 08:20:51 that means that this feature is currently not avai
jochen (gone - plz use gerrit) 2016/09/15 08:20:51 that means that this feature is currently not avai
Alfonso 2016/09/16 14:21:48 Refactor to use V8PrivateProperty to expose privat
+ DEFINE_STATIC_LOCAL(StringPrivateMap, map, ());
haraken 2016/09/15 09:26:10 If this map is intended to be per-isolate, can you
Alfonso 2016/09/16 14:21:48 Done.
+ return map;
+ }
+
private:
WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
bool initialize();

Powered by Google App Engine
This is Rietveld 408576698