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

Side by Side 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 unified diff | Download patch
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 22 matching lines...) Expand all
33 33
34 #include "bindings/core/v8/DOMWrapperWorld.h" 34 #include "bindings/core/v8/DOMWrapperWorld.h"
35 #include "bindings/core/v8/ScopedPersistent.h" 35 #include "bindings/core/v8/ScopedPersistent.h"
36 #include "bindings/core/v8/ScriptState.h" 36 #include "bindings/core/v8/ScriptState.h"
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 #include "platform/weborigin/SecurityOrigin.h" 38 #include "platform/weborigin/SecurityOrigin.h"
39 #include "wtf/HashMap.h" 39 #include "wtf/HashMap.h"
40 #include "wtf/PassRefPtr.h" 40 #include "wtf/PassRefPtr.h"
41 #include "wtf/RefPtr.h" 41 #include "wtf/RefPtr.h"
42 #include "wtf/text/AtomicString.h" 42 #include "wtf/text/AtomicString.h"
43 #include <map>
43 #include <v8.h> 44 #include <v8.h>
44 45
45 namespace blink { 46 namespace blink {
46 47
47 class Frame; 48 class Frame;
48 class HTMLDocument; 49 class HTMLDocument;
49 class SecurityOrigin; 50 class SecurityOrigin;
50 51
51 // WindowProxy represents all the per-global object state for a Frame that 52 // WindowProxy represents all the per-global object state for a Frame that
52 // persist between navigations. 53 // persist between navigations.
(...skipping 25 matching lines...) Expand all
78 79
79 void clearForNavigation(); 80 void clearForNavigation();
80 void clearForClose(); 81 void clearForClose();
81 82
82 v8::Local<v8::Object> globalIfNotDetached(); 83 v8::Local<v8::Object> globalIfNotDetached();
83 v8::Local<v8::Object> releaseGlobal(); 84 v8::Local<v8::Object> releaseGlobal();
84 void setGlobal(v8::Local<v8::Object>); 85 void setGlobal(v8::Local<v8::Object>);
85 86
86 DOMWrapperWorld& world() { return *m_world; } 87 DOMWrapperWorld& world() { return *m_world; }
87 88
89 // Global map, 'name' -> private property for all cached accessors.
90 typedef std::map<std::string, v8::Eternal<v8::Private>> StringPrivateMap;
91 static StringPrivateMap& cachedAccessors()
92 {
93 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
94 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.
95 return map;
96 }
97
88 private: 98 private:
89 WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*); 99 WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
90 bool initialize(); 100 bool initialize();
91 101
92 enum GlobalDetachmentBehavior { 102 enum GlobalDetachmentBehavior {
93 DoNotDetachGlobal, 103 DoNotDetachGlobal,
94 DetachGlobal 104 DetachGlobal
95 }; 105 };
96 void disposeContext(GlobalDetachmentBehavior); 106 void disposeContext(GlobalDetachmentBehavior);
97 107
(...skipping 21 matching lines...) Expand all
119 v8::Isolate* m_isolate; 129 v8::Isolate* m_isolate;
120 RefPtr<ScriptState> m_scriptState; 130 RefPtr<ScriptState> m_scriptState;
121 RefPtr<DOMWrapperWorld> m_world; 131 RefPtr<DOMWrapperWorld> m_world;
122 ScopedPersistent<v8::Object> m_global; 132 ScopedPersistent<v8::Object> m_global;
123 ScopedPersistent<v8::Object> m_document; 133 ScopedPersistent<v8::Object> m_document;
124 }; 134 };
125 135
126 } // namespace blink 136 } // namespace blink
127 137
128 #endif // WindowProxy_h 138 #endif // WindowProxy_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698