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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 m_context(isolate->GetCurrentContext()), | 144 m_context(isolate->GetCurrentContext()), |
145 m_tryCatch(isolate), | 145 m_tryCatch(isolate), |
146 m_convertExceptions(false) { | 146 m_convertExceptions(false) { |
147 // creationContext should not be empty. Because if we have an | 147 // creationContext should not be empty. Because if we have an |
148 // empty creationContext, we will end up creating | 148 // empty creationContext, we will end up creating |
149 // a new object in the context currently entered. This is wrong. | 149 // a new object in the context currently entered. This is wrong. |
150 RELEASE_ASSERT(!creationContext.IsEmpty()); | 150 RELEASE_ASSERT(!creationContext.IsEmpty()); |
151 v8::Local<v8::Context> contextForWrapper = | 151 v8::Local<v8::Context> contextForWrapper = |
152 creationContext->CreationContext(); | 152 creationContext->CreationContext(); |
153 | 153 |
154 // For performance, we enter the context only if the currently running conte
xt | 154 // For performance, we enter the context only if the currently running |
155 // is different from the context that we are about to enter. | 155 // context is different from the context that we are about to enter. |
156 if (contextForWrapper == m_context) | 156 if (contextForWrapper == m_context) |
157 return; | 157 return; |
158 if (withSecurityCheck) { | 158 if (withSecurityCheck) { |
159 securityCheck(isolate, contextForWrapper); | 159 securityCheck(isolate, contextForWrapper); |
160 } else { | 160 } else { |
161 m_convertExceptions = true; | 161 m_convertExceptions = true; |
162 } | 162 } |
163 m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper); | 163 m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper); |
164 m_didEnterContext = true; | 164 m_didEnterContext = true; |
165 m_context->Enter(); | 165 m_context->Enter(); |
(...skipping 23 matching lines...) Expand all Loading... |
189 | 189 |
190 bool m_didEnterContext; | 190 bool m_didEnterContext; |
191 v8::Local<v8::Context> m_context; | 191 v8::Local<v8::Context> m_context; |
192 v8::TryCatch m_tryCatch; | 192 v8::TryCatch m_tryCatch; |
193 bool m_convertExceptions; | 193 bool m_convertExceptions; |
194 }; | 194 }; |
195 | 195 |
196 } // namespace blink | 196 } // namespace blink |
197 | 197 |
198 #endif // V8DOMWrapper_h | 198 #endif // V8DOMWrapper_h |
OLD | NEW |