Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, Google Inc. |
| 2 // All rights reserved. | 2 // 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 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 #include "DartDocument.h" | 38 #include "DartDocument.h" |
| 39 #include "DartService.h" | 39 #include "DartService.h" |
| 40 #include "DartWindow.h" | 40 #include "DartWindow.h" |
| 41 #include "HTMLNames.h" | 41 #include "HTMLNames.h" |
| 42 #include "bindings/common/ScheduledAction.h" | 42 #include "bindings/common/ScheduledAction.h" |
| 43 #include "bindings/dart/DartApplicationLoader.h" | 43 #include "bindings/dart/DartApplicationLoader.h" |
| 44 #include "bindings/dart/DartAsyncLoader.h" | 44 #include "bindings/dart/DartAsyncLoader.h" |
| 45 #include "bindings/dart/DartDOMData.h" | 45 #include "bindings/dart/DartDOMData.h" |
| 46 #include "bindings/dart/DartDOMWrapper.h" | 46 #include "bindings/dart/DartDOMWrapper.h" |
| 47 #include "bindings/dart/DartDebugServer.h" | |
| 48 #include "bindings/dart/DartGCController.h" | 47 #include "bindings/dart/DartGCController.h" |
| 49 #include "bindings/dart/DartInspectorTimeline.h" | 48 #include "bindings/dart/DartInspectorTimeline.h" |
| 50 #include "bindings/dart/DartIsolateDestructionObserver.h" | 49 #include "bindings/dart/DartIsolateDestructionObserver.h" |
| 51 #include "bindings/dart/DartJsInterop.h" | 50 #include "bindings/dart/DartJsInterop.h" |
| 52 #include "bindings/dart/DartNativeUtilities.h" | 51 #include "bindings/dart/DartNativeUtilities.h" |
| 52 #include "bindings/dart/DartScriptDebugServer.h" | |
| 53 #include "bindings/dart/DartScriptState.h" | 53 #include "bindings/dart/DartScriptState.h" |
| 54 #include "bindings/dart/DartUtilities.h" | 54 #include "bindings/dart/DartUtilities.h" |
| 55 #include "bindings/dart/ThreadSafeDartIsolateWrapper.h" | 55 #include "bindings/dart/ThreadSafeDartIsolateWrapper.h" |
| 56 #include "bindings/v8/ScriptController.h" | 56 #include "bindings/v8/ScriptController.h" |
| 57 #include "bindings/v8/V8Binding.h" | 57 #include "bindings/v8/V8Binding.h" |
| 58 #include "core/dom/Document.h" | 58 #include "core/dom/Document.h" |
| 59 #include "core/dom/ExecutionContext.h" | 59 #include "core/dom/ExecutionContext.h" |
| 60 #include "core/dom/ExecutionContextTask.h" | 60 #include "core/dom/ExecutionContextTask.h" |
| 61 #include "core/dom/MutationObserver.h" | 61 #include "core/dom/MutationObserver.h" |
| 62 #include "core/dom/NodeList.h" | 62 #include "core/dom/NodeList.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 // this persistent handle explicitly because we will shutdown the isolat e on | 198 // this persistent handle explicitly because we will shutdown the isolat e on |
| 199 // navigation. | 199 // navigation. |
| 200 Dart_Handle localHandle = DartDocument::toDart(document); | 200 Dart_Handle localHandle = DartDocument::toDart(document); |
| 201 Dart_PersistentHandle ALLOW_UNUSED strongHandle = Dart_NewPersistentHand le(localHandle); | 201 Dart_PersistentHandle ALLOW_UNUSED strongHandle = Dart_NewPersistentHand le(localHandle); |
| 202 // We need a weak handle to an always reachable object in order to tempo rarily make | 202 // We need a weak handle to an always reachable object in order to tempo rarily make |
| 203 // weak handles strong during GC, see the corresponding logic in DartGCC ontroller. | 203 // weak handles strong during GC, see the corresponding logic in DartGCC ontroller. |
| 204 domData->setReachableWeakHandle(Dart_NewWeakPersistentHandle(localHandle , 0, 0, DartController::weakCallback)); | 204 domData->setReachableWeakHandle(Dart_NewWeakPersistentHandle(localHandle , 0, 0, DartController::weakCallback)); |
| 205 Dart_SetMessageNotifyCallback(&messageNotifyCallback); | 205 Dart_SetMessageNotifyCallback(&messageNotifyCallback); |
| 206 Dart_SetGcCallbacks(&DartGCController::prologueCallback, &DartGCControll er::epilogueCallback); | 206 Dart_SetGcCallbacks(&DartGCController::prologueCallback, &DartGCControll er::epilogueCallback); |
| 207 | 207 |
| 208 if (isDebuggerEnabled) { | 208 if (isDebuggerEnabled) { |
|
vsm
2014/06/03 14:24:49
When is this enabled? I seem to hit this path reg
Jacob
2014/06/03 20:23:13
I believe the flag is always true unless you start
| |
| 209 DART_RECORD_TIMER(" createIsolate before debug setup"); | 209 DART_RECORD_TIMER(" createIsolate before debug setup"); |
| 210 DartDebugServer::shared().registerIsolate(isolate); | 210 DartScriptDebugServer::shared().registerIsolate(isolate, document->p age()); |
| 211 DART_RECORD_TIMER(" createIsolate after debug setup"); | 211 DART_RECORD_TIMER(" createIsolate after debug setup"); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 DART_RECORD_TIMER(" createIsolate done %.3f ms"); | 214 DART_RECORD_TIMER(" createIsolate done %.3f ms"); |
| 215 | 215 |
| 216 return isolate; | 216 return isolate; |
| 217 } | 217 } |
| 218 | 218 |
| 219 Dart_Isolate DartController::createDOMEnabledIsolate(const String& scriptURL, co nst String& entryPoint, Document* document) | 219 Dart_Isolate DartController::createDOMEnabledIsolate(const String& scriptURL, co nst String& entryPoint, Document* document) |
| 220 { | 220 { |
| 221 DART_START_TIMER(); | 221 DART_START_TIMER(); |
| 222 ASSERT(!Dart_CurrentIsolate()); | 222 ASSERT(!Dart_CurrentIsolate()); |
| 223 | 223 |
| 224 // FIXME: proper error reporting. | 224 // FIXME: proper error reporting. |
| 225 char* errorMessage = 0; | 225 char* errorMessage = 0; |
| 226 Dart_Isolate newIsolate = createIsolate(scriptURL.utf8().data(), entryPoint. utf8().data(), document, true, true, &errorMessage); | 226 Dart_Isolate newIsolate = createIsolate(scriptURL.utf8().data(), entryPoint. utf8().data(), document, true, true, &errorMessage); |
| 227 ASSERT(newIsolate); | 227 ASSERT(newIsolate); |
| 228 m_isolates.append(newIsolate); | 228 m_isolates.append(newIsolate); |
| 229 DART_RECORD_TIMER(" createDOMEnabledIsolate took"); | 229 DART_RECORD_TIMER(" createDOMEnabledIsolate took"); |
| 230 return newIsolate; | 230 return newIsolate; |
| 231 } | 231 } |
| 232 | 232 |
| 233 void DartController::shutdownIsolate(Dart_Isolate isolate) | 233 void DartController::shutdownIsolate(Dart_Isolate isolate) |
| 234 { | 234 { |
| 235 DartDOMData* domData = DartDOMData::current(); | 235 DartDOMData* domData = DartDOMData::current(); |
| 236 ASSERT(domData->isDOMEnabled()); | 236 ASSERT(domData->isDOMEnabled()); |
| 237 // If the following assert triggers, we have hit dartbug.com/14183 | 237 // If the following assert triggers, we have hit dartbug.com/14183 |
| 238 // FIXME: keep the isolate alive until the recursion level is 0. | 238 // FIXME: keep the isolate alive until the recursion level is 0. |
| 239 ASSERT(!*(domData->recursion())); | 239 ASSERT(!*(domData->recursion())); |
| 240 DartDebugServer::shared().unregisterIsolate(isolate); | 240 DartScriptDebugServer::shared().unregisterIsolate(isolate, m_frame->page()); |
| 241 DartIsolateDestructionObservers* observers = domData->isolateDestructionObse rvers(); | 241 DartIsolateDestructionObservers* observers = domData->isolateDestructionObse rvers(); |
| 242 for (DartIsolateDestructionObservers::iterator it = observers->begin(); it ! = observers->end(); ++it) | 242 for (DartIsolateDestructionObservers::iterator it = observers->begin(); it ! = observers->end(); ++it) |
| 243 (*it)->isolateDestroyed(); | 243 (*it)->isolateDestroyed(); |
| 244 Dart_ShutdownIsolate(); | 244 Dart_ShutdownIsolate(); |
| 245 delete domData; | 245 delete domData; |
| 246 } | 246 } |
| 247 | 247 |
| 248 DartController::DartController(LocalFrame* frame) | 248 DartController::DartController(LocalFrame* frame) |
| 249 : m_frame(frame) | 249 : m_frame(frame) |
| 250 , m_asyncLoader(0) | 250 , m_asyncLoader(0) |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 919 DartAsyncLoader* asyncLoader = new DartAsyncLoader(); | 919 DartAsyncLoader* asyncLoader = new DartAsyncLoader(); |
| 920 asyncLoader->processSingleRequest(url, callback); | 920 asyncLoader->processSingleRequest(url, callback); |
| 921 | 921 |
| 922 // Restore caller isolate. | 922 // Restore caller isolate. |
| 923 Dart_EnterIsolate(caller); | 923 Dart_EnterIsolate(caller); |
| 924 | 924 |
| 925 // FIXME: We need some way to return a Dart_Handle to the isolate we just cr eated. | 925 // FIXME: We need some way to return a Dart_Handle to the isolate we just cr eated. |
| 926 } | 926 } |
| 927 | 927 |
| 928 } | 928 } |
| OLD | NEW |