OLD | NEW |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 namespace WebCore { | 47 namespace WebCore { |
48 | 48 |
49 class DOMWindow; | 49 class DOMWindow; |
50 class Frame; | 50 class Frame; |
51 class HTMLDocument; | 51 class HTMLDocument; |
52 | 52 |
53 // V8WindowShell represents all the per-global object state for a Frame that | 53 // V8WindowShell represents all the per-global object state for a Frame that |
54 // persist between navigations. | 54 // persist between navigations. |
55 class V8DOMWindowShell { | 55 class V8DOMWindowShell { |
56 public: | 56 public: |
| 57 enum ContextDescriptor { |
| 58 DomContext, |
| 59 BlinkJSContext, |
| 60 }; |
| 61 |
| 62 class ContextScope { |
| 63 public: |
| 64 ContextScope(V8DOMWindowShell*, ContextDescriptor); |
| 65 ~ContextScope() { } |
| 66 |
| 67 static V8DOMWindowShell* currentWindowShell(); |
| 68 private: |
| 69 ContextDescriptor m_descriptor; |
| 70 v8::Context::Scope m_scope; |
| 71 }; |
| 72 |
57 static PassOwnPtr<V8DOMWindowShell> create(Frame*, PassRefPtr<DOMWrapperWorl
d>, v8::Isolate*); | 73 static PassOwnPtr<V8DOMWindowShell> create(Frame*, PassRefPtr<DOMWrapperWorl
d>, v8::Isolate*); |
58 | 74 |
59 v8::Local<v8::Context> context() const { return v8::Local<v8::Context>::New(
m_context.get()); } | 75 v8::Local<v8::Context> context() const { return v8::Local<v8::Context>::New(
m_context.get()); } |
60 | 76 |
61 // Update document object of the frame. | 77 // Update document object of the frame. |
62 void updateDocument(); | 78 void updateDocument(); |
63 | 79 |
64 void namedItemAdded(HTMLDocument*, const AtomicString&); | 80 void namedItemAdded(HTMLDocument*, const AtomicString&); |
65 void namedItemRemoved(HTMLDocument*, const AtomicString&); | 81 void namedItemRemoved(HTMLDocument*, const AtomicString&); |
66 | 82 |
(...skipping 29 matching lines...) Expand all Loading... |
96 void createContext(); | 112 void createContext(); |
97 bool installDOMWindow(); | 113 bool installDOMWindow(); |
98 | 114 |
99 static V8DOMWindowShell* enteredIsolatedWorldContext(); | 115 static V8DOMWindowShell* enteredIsolatedWorldContext(); |
100 | 116 |
101 Frame* m_frame; | 117 Frame* m_frame; |
102 RefPtr<DOMWrapperWorld> m_world; | 118 RefPtr<DOMWrapperWorld> m_world; |
103 v8::Isolate* m_isolate; | 119 v8::Isolate* m_isolate; |
104 | 120 |
105 OwnPtr<V8PerContextData> m_perContextData; | 121 OwnPtr<V8PerContextData> m_perContextData; |
| 122 OwnPtr<V8PerContextData> m_perContextDataForBlinkJS; |
106 | 123 |
107 ScopedPersistent<v8::Context> m_context; | 124 ScopedPersistent<v8::Context> m_context; |
108 ScopedPersistent<v8::Object> m_global; | 125 ScopedPersistent<v8::Object> m_global; |
109 ScopedPersistent<v8::Object> m_document; | 126 ScopedPersistent<v8::Object> m_document; |
| 127 ScopedPersistent<v8::Context> m_contextForBlinkJS; |
110 }; | 128 }; |
111 | 129 |
112 } // namespace WebCore | 130 } // namespace WebCore |
113 | 131 |
114 #endif // V8DOMWindowShell_h | 132 #endif // V8DOMWindowShell_h |
OLD | NEW |