OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; | 54 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; |
55 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; | 55 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; |
56 | 56 |
57 enum V8ContextEmbedderDataField { | 57 enum V8ContextEmbedderDataField { |
58 v8ContextDebugIdIndex = static_cast<int>(gin::kDebugIdIndex), | 58 v8ContextDebugIdIndex = static_cast<int>(gin::kDebugIdIndex), |
59 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd
ex + gin::kEmbedderBlink), | 59 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd
ex + gin::kEmbedderBlink), |
60 }; | 60 }; |
61 | 61 |
62 class V8PerContextData { | 62 class V8PerContextData { |
63 public: | 63 public: |
64 static PassOwnPtr<V8PerContextData> create(v8::Handle<v8::Context> context,
PassRefPtr<DOMWrapperWorld> world) | 64 static PassOwnPtr<V8PerContextData> create(v8::Handle<v8::Context>, PassRefP
tr<DOMWrapperWorld>); |
65 { | |
66 return adoptPtr(new V8PerContextData(context, world)); | |
67 } | |
68 | 65 |
69 static V8PerContextData* from(v8::Handle<v8::Context>); | 66 static V8PerContextData* from(v8::Handle<v8::Context>); |
70 | 67 |
71 ~V8PerContextData(); | 68 ~V8PerContextData(); |
72 | 69 |
73 v8::Handle<v8::Context> context() { return m_context.newLocal(m_isolate); } | 70 v8::Handle<v8::Context> context() { return m_context.newLocal(m_isolate); } |
74 | 71 |
75 // To create JS Wrapper objects, we create a cache of a 'boiler plate' | 72 // To create JS Wrapper objects, we create a cache of a 'boiler plate' |
76 // object, and then simply Clone that object each time we need a new one. | 73 // object, and then simply Clone that object each time we need a new one. |
77 // This is faster than going through the full object creation process. | 74 // This is faster than going through the full object creation process. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 128 |
132 class V8PerContextDebugData { | 129 class V8PerContextDebugData { |
133 public: | 130 public: |
134 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); | 131 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); |
135 static int contextDebugId(v8::Handle<v8::Context>); | 132 static int contextDebugId(v8::Handle<v8::Context>); |
136 }; | 133 }; |
137 | 134 |
138 } // namespace WebCore | 135 } // namespace WebCore |
139 | 136 |
140 #endif // V8PerContextData_h | 137 #endif // V8PerContextData_h |
OLD | NEW |