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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "v8.h" | 32 #include "v8.h" |
33 #include "wtf/RefPtr.h" | 33 #include "wtf/RefPtr.h" |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 class DOMRequestState { | 37 class DOMRequestState { |
38 public: | 38 public: |
39 explicit DOMRequestState(ScriptExecutionContext* scriptExecutionContext) | 39 explicit DOMRequestState(ScriptExecutionContext* scriptExecutionContext) |
40 : m_scriptExecutionContext(scriptExecutionContext) | 40 : m_scriptExecutionContext(scriptExecutionContext) |
41 , m_world(DOMWrapperWorld::current()) | 41 , m_world(DOMWrapperWorld::current()) |
| 42 , m_isolate(getIsolateFromScriptExecutionContext(scriptExecutionContext)
) |
42 { | 43 { |
43 } | 44 } |
44 | 45 |
45 void clear() | 46 void clear() |
46 { | 47 { |
47 m_scriptExecutionContext = 0; | 48 m_scriptExecutionContext = 0; |
48 m_world.clear(); | 49 m_world.clear(); |
49 } | 50 } |
50 | 51 |
51 class Scope { | 52 class Scope { |
52 public: | 53 public: |
53 explicit Scope(DOMRequestState& state) | 54 explicit Scope(DOMRequestState& state) |
54 : m_contextScope(state.context()) | 55 : m_handleScope(state.isolate()) |
| 56 , m_contextScope(state.context()) |
55 { | 57 { |
56 } | 58 } |
57 private: | 59 private: |
58 v8::HandleScope m_handleScope; | 60 v8::HandleScope m_handleScope; |
59 v8::Context::Scope m_contextScope; | 61 v8::Context::Scope m_contextScope; |
60 }; | 62 }; |
61 | 63 |
62 v8::Local<v8::Context> context() | 64 v8::Local<v8::Context> context() |
63 { | 65 { |
64 return toV8Context(m_scriptExecutionContext, m_world.get()); | 66 return toV8Context(m_scriptExecutionContext, m_world.get()); |
65 } | 67 } |
66 | 68 |
| 69 v8::Isolate* isolate() const |
| 70 { |
| 71 return m_isolate; |
| 72 } |
| 73 |
67 private: | 74 private: |
68 ScriptExecutionContext* m_scriptExecutionContext; | 75 ScriptExecutionContext* m_scriptExecutionContext; |
69 RefPtr<DOMWrapperWorld> m_world; | 76 RefPtr<DOMWrapperWorld> m_world; |
| 77 v8::Isolate* m_isolate; |
70 }; | 78 }; |
71 | 79 |
72 } | 80 } |
73 #endif | 81 #endif |
OLD | NEW |