| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #if ENABLE(ASSERT) | 70 #if ENABLE(ASSERT) |
| 71 , m_internalScriptRecursionLevel(0) | 71 , m_internalScriptRecursionLevel(0) |
| 72 #endif | 72 #endif |
| 73 , m_gcEventData(adoptPtr(new GCEventData())) | 73 , m_gcEventData(adoptPtr(new GCEventData())) |
| 74 , m_performingMicrotaskCheckpoint(false) | 74 , m_performingMicrotaskCheckpoint(false) |
| 75 { | 75 { |
| 76 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. | 76 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. |
| 77 isolate()->Enter(); | 77 isolate()->Enter(); |
| 78 #if ENABLE(ASSERT) | 78 #if ENABLE(ASSERT) |
| 79 // currentThread will always be non-null in production, but can be null in C
hromium unit tests. | 79 // currentThread will always be non-null in production, but can be null in C
hromium unit tests. |
| 80 if (blink::Platform::current()->currentThread()) | 80 isolate()->AddCallCompletedCallback(&assertV8RecursionScope); |
| 81 isolate()->AddCallCompletedCallback(&assertV8RecursionScope); | |
| 82 #endif | 81 #endif |
| 83 if (isMainThread()) { | 82 if (isMainThread()) |
| 84 mainThreadPerIsolateData = this; | 83 mainThreadPerIsolateData = this; |
| 85 } | |
| 86 isolate()->SetUseCounterCallback(&useCounterCallback); | 84 isolate()->SetUseCounterCallback(&useCounterCallback); |
| 87 } | 85 } |
| 88 | 86 |
| 89 V8PerIsolateData::~V8PerIsolateData() | 87 V8PerIsolateData::~V8PerIsolateData() |
| 90 { | 88 { |
| 91 if (m_scriptRegexpScriptState) | 89 if (m_scriptRegexpScriptState) |
| 92 m_scriptRegexpScriptState->disposePerContextData(); | 90 m_scriptRegexpScriptState->disposePerContextData(); |
| 93 if (isMainThread()) | 91 if (isMainThread()) |
| 94 mainThreadPerIsolateData = 0; | 92 mainThreadPerIsolateData = 0; |
| 95 } | 93 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 112 v8::Persistent<v8::Value>& V8PerIsolateData::ensureLiveRoot() | 110 v8::Persistent<v8::Value>& V8PerIsolateData::ensureLiveRoot() |
| 113 { | 111 { |
| 114 if (m_liveRoot.isEmpty()) | 112 if (m_liveRoot.isEmpty()) |
| 115 m_liveRoot.set(isolate(), v8::Null(isolate())); | 113 m_liveRoot.set(isolate(), v8::Null(isolate())); |
| 116 return m_liveRoot.getUnsafe(); | 114 return m_liveRoot.getUnsafe(); |
| 117 } | 115 } |
| 118 | 116 |
| 119 void V8PerIsolateData::dispose(v8::Isolate* isolate) | 117 void V8PerIsolateData::dispose(v8::Isolate* isolate) |
| 120 { | 118 { |
| 121 #if ENABLE(ASSERT) | 119 #if ENABLE(ASSERT) |
| 122 if (blink::Platform::current()->currentThread()) | 120 isolate->RemoveCallCompletedCallback(&assertV8RecursionScope); |
| 123 isolate->RemoveCallCompletedCallback(&assertV8RecursionScope); | |
| 124 #endif | 121 #endif |
| 125 void* data = isolate->GetData(gin::kEmbedderBlink); | 122 void* data = isolate->GetData(gin::kEmbedderBlink); |
| 126 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. | 123 // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. |
| 127 isolate->Exit(); | 124 isolate->Exit(); |
| 128 delete static_cast<V8PerIsolateData*>(data); | 125 delete static_cast<V8PerIsolateData*>(data); |
| 129 } | 126 } |
| 130 | 127 |
| 131 V8PerIsolateData::DOMTemplateMap& V8PerIsolateData::currentDOMTemplateMap() | 128 V8PerIsolateData::DOMTemplateMap& V8PerIsolateData::currentDOMTemplateMap() |
| 132 { | 129 { |
| 133 if (DOMWrapperWorld::current(isolate()).isMainWorld()) | 130 if (DOMWrapperWorld::current(isolate()).isMainWorld()) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 220 } |
| 224 | 221 |
| 225 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() | 222 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() |
| 226 { | 223 { |
| 227 if (m_toStringTemplate.isEmpty()) | 224 if (m_toStringTemplate.isEmpty()) |
| 228 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c
onstructorOfToString)); | 225 m_toStringTemplate.set(isolate(), v8::FunctionTemplate::New(isolate(), c
onstructorOfToString)); |
| 229 return m_toStringTemplate.newLocal(isolate()); | 226 return m_toStringTemplate.newLocal(isolate()); |
| 230 } | 227 } |
| 231 | 228 |
| 232 } // namespace blink | 229 } // namespace blink |
| OLD | NEW |