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

Side by Side Diff: Source/bindings/core/v8/WindowProxy.h

Issue 451013003: Rename V8WindowShell to WindowProxy (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/core/v8/V8WindowShell.cpp ('k') | Source/bindings/core/v8/WindowProxy.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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 V8WindowShell_h 31 #ifndef WindowProxy_h
32 #define V8WindowShell_h 32 #define WindowProxy_h
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 "bindings/core/v8/WrapperTypeInfo.h" 37 #include "bindings/core/v8/WrapperTypeInfo.h"
38 #include "platform/weborigin/SecurityOrigin.h" 38 #include "platform/weborigin/SecurityOrigin.h"
39 #include "wtf/Forward.h" 39 #include "wtf/Forward.h"
40 #include "wtf/HashMap.h" 40 #include "wtf/HashMap.h"
41 #include "wtf/PassRefPtr.h" 41 #include "wtf/PassRefPtr.h"
42 #include "wtf/RefCounted.h" 42 #include "wtf/RefCounted.h"
43 #include "wtf/RefPtr.h" 43 #include "wtf/RefPtr.h"
44 #include "wtf/text/AtomicString.h" 44 #include "wtf/text/AtomicString.h"
45 #include <v8.h> 45 #include <v8.h>
46 46
47 namespace blink { 47 namespace blink {
48 48
49 class LocalDOMWindow; 49 class LocalDOMWindow;
50 class LocalFrame; 50 class LocalFrame;
51 class HTMLDocument; 51 class HTMLDocument;
52 class SecurityOrigin; 52 class SecurityOrigin;
53 53
54 // V8WindowShell represents all the per-global object state for a LocalFrame tha t 54 // WindowProxy represents all the per-global object state for a LocalFrame that
55 // persist between navigations. 55 // persist between navigations.
56 class V8WindowShell { 56 class WindowProxy {
57 public: 57 public:
58 static PassOwnPtr<V8WindowShell> create(LocalFrame*, DOMWrapperWorld&, v8::I solate*); 58 static PassOwnPtr<WindowProxy> create(LocalFrame*, DOMWrapperWorld&, v8::Iso late*);
59 59
60 v8::Local<v8::Context> context() const { return m_scriptState ? m_scriptStat e->context() : v8::Local<v8::Context>(); } 60 v8::Local<v8::Context> context() const { return m_scriptState ? m_scriptStat e->context() : v8::Local<v8::Context>(); }
61 ScriptState* scriptState() const { return m_scriptState.get(); } 61 ScriptState* scriptState() const { return m_scriptState.get(); }
62 62
63 // Update document object of the frame. 63 // Update document object of the frame.
64 void updateDocument(); 64 void updateDocument();
65 65
66 void namedItemAdded(HTMLDocument*, const AtomicString&); 66 void namedItemAdded(HTMLDocument*, const AtomicString&);
67 void namedItemRemoved(HTMLDocument*, const AtomicString&); 67 void namedItemRemoved(HTMLDocument*, const AtomicString&);
68 68
69 // Update the security origin of a document 69 // Update the security origin of a document
70 // (e.g., after setting docoument.domain). 70 // (e.g., after setting docoument.domain).
71 void updateSecurityOrigin(SecurityOrigin*); 71 void updateSecurityOrigin(SecurityOrigin*);
72 72
73 bool isContextInitialized() { return m_scriptState && !!m_scriptState->perCo ntextData(); } 73 bool isContextInitialized() { return m_scriptState && !!m_scriptState->perCo ntextData(); }
74 bool isGlobalInitialized() { return !m_global.isEmpty(); } 74 bool isGlobalInitialized() { return !m_global.isEmpty(); }
75 75
76 bool initializeIfNeeded(); 76 bool initializeIfNeeded();
77 void updateDocumentWrapper(v8::Handle<v8::Object> wrapper); 77 void updateDocumentWrapper(v8::Handle<v8::Object> wrapper);
78 78
79 void clearForNavigation(); 79 void clearForNavigation();
80 void clearForClose(); 80 void clearForClose();
81 81
82 DOMWrapperWorld& world() { return *m_world; } 82 DOMWrapperWorld& world() { return *m_world; }
83 83
84 private: 84 private:
85 V8WindowShell(LocalFrame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*); 85 WindowProxy(LocalFrame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
86 bool initialize(); 86 bool initialize();
87 87
88 enum GlobalDetachmentBehavior { 88 enum GlobalDetachmentBehavior {
89 DoNotDetachGlobal, 89 DoNotDetachGlobal,
90 DetachGlobal 90 DetachGlobal
91 }; 91 };
92 void disposeContext(GlobalDetachmentBehavior); 92 void disposeContext(GlobalDetachmentBehavior);
93 93
94 void setSecurityToken(SecurityOrigin*); 94 void setSecurityToken(SecurityOrigin*);
95 95
96 // The JavaScript wrapper for the document object is cached on the global 96 // The JavaScript wrapper for the document object is cached on the global
97 // object for fast access. UpdateDocumentProperty sets the wrapper 97 // object for fast access. UpdateDocumentProperty sets the wrapper
98 // for the current document on the global object. ClearDocumentProperty 98 // for the current document on the global object. ClearDocumentProperty
99 // deletes the document wrapper from the global object. 99 // deletes the document wrapper from the global object.
100 void updateDocumentProperty(); 100 void updateDocumentProperty();
101 void clearDocumentProperty(); 101 void clearDocumentProperty();
102 102
103 // Updates Activity Logger for the current context. 103 // Updates Activity Logger for the current context.
104 void updateActivityLogger(); 104 void updateActivityLogger();
105 105
106 void createContext(); 106 void createContext();
107 bool installDOMWindow(); 107 bool installDOMWindow();
108 108
109 static V8WindowShell* enteredIsolatedWorldContext(); 109 static WindowProxy* enteredIsolatedWorldContext();
110 110
111 LocalFrame* m_frame; 111 LocalFrame* m_frame;
112 v8::Isolate* m_isolate; 112 v8::Isolate* m_isolate;
113 RefPtr<ScriptState> m_scriptState; 113 RefPtr<ScriptState> m_scriptState;
114 RefPtr<DOMWrapperWorld> m_world; 114 RefPtr<DOMWrapperWorld> m_world;
115 ScopedPersistent<v8::Object> m_global; 115 ScopedPersistent<v8::Object> m_global;
116 ScopedPersistent<v8::Object> m_document; 116 ScopedPersistent<v8::Object> m_document;
117 }; 117 };
118 118
119 } // namespace blink 119 } // namespace blink
120 120
121 #endif // V8WindowShell_h 121 #endif // WindowProxy_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8WindowShell.cpp ('k') | Source/bindings/core/v8/WindowProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698