| OLD | NEW |
| 1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 , m_recursion(0) | 262 , m_recursion(0) |
| 263 { | 263 { |
| 264 if (!context) | 264 if (!context) |
| 265 return; | 265 return; |
| 266 | 266 |
| 267 ASSERT(context->isDocument()); // WorkerContext is not supported yet. | 267 ASSERT(context->isDocument()); // WorkerContext is not supported yet. |
| 268 Document* document = static_cast<Document*>(context); | 268 Document* document = static_cast<Document*>(context); |
| 269 m_domWindow = document->domWindow(); | 269 m_domWindow = document->domWindow(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 ~DartDOMData() |
| 273 { |
| 274 ASSERT(m_domMap.isEmpty()); |
| 275 } |
| 276 |
| 272 PassRefPtr<DartApplicationLoader> applicationLoader() { return m_application
Loader; } | 277 PassRefPtr<DartApplicationLoader> applicationLoader() { return m_application
Loader; } |
| 273 ScriptExecutionContext* scriptExecutionContext() { return m_scriptExecutionC
ontext; } | 278 ScriptExecutionContext* scriptExecutionContext() { return m_scriptExecutionC
ontext; } |
| 274 DOMWindow* domWindow() { return m_domWindow; } | 279 DOMWindow* domWindow() { return m_domWindow; } |
| 275 DartDOMMap* domMap() { return &m_domMap; } | 280 DartDOMMap* domMap() { return &m_domMap; } |
| 276 int* recursion() { return &m_recursion; } | 281 int* recursion() { return &m_recursion; } |
| 277 | 282 |
| 278 private: | 283 private: |
| 279 RefPtr<DartApplicationLoader> m_applicationLoader; | 284 RefPtr<DartApplicationLoader> m_applicationLoader; |
| 280 ScriptExecutionContext* m_scriptExecutionContext; | 285 ScriptExecutionContext* m_scriptExecutionContext; |
| 281 DOMWindow* m_domWindow; | 286 DOMWindow* m_domWindow; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 293 | 298 |
| 294 static DartDOMData* domDataForIsolate(Dart_Isolate isolate) | 299 static DartDOMData* domDataForIsolate(Dart_Isolate isolate) |
| 295 { | 300 { |
| 296 IsolateToDartDOMDataMap::iterator it = isolateToDartDOMDataMap().find(isolat
e); | 301 IsolateToDartDOMDataMap::iterator it = isolateToDartDOMDataMap().find(isolat
e); |
| 297 ASSERT(it != isolateToDartDOMDataMap().end()); | 302 ASSERT(it != isolateToDartDOMDataMap().end()); |
| 298 return it->second; | 303 return it->second; |
| 299 } | 304 } |
| 300 | 305 |
| 301 static DartDOMData* currentDOMData() | 306 static DartDOMData* currentDOMData() |
| 302 { | 307 { |
| 303 return domDataForIsolate(DartIsolate::current()->isolate()); | 308 return domDataForIsolate(Dart_CurrentIsolate()); |
| 304 } | 309 } |
| 305 | 310 |
| 306 void DartUtilities::registerDOMIsolate(Dart_Isolate isolate, PassRefPtr<DartAppl
icationLoader> applicationLoader, ScriptExecutionContext* context) | 311 void DartUtilities::registerDOMIsolate(Dart_Isolate isolate, PassRefPtr<DartAppl
icationLoader> applicationLoader, ScriptExecutionContext* context) |
| 307 { | 312 { |
| 308 ASSERT(!isolateToDartDOMDataMap().contains(isolate)); | 313 ASSERT(!isolateToDartDOMDataMap().contains(isolate)); |
| 309 isolateToDartDOMDataMap().set(isolate, new DartDOMData(applicationLoader, co
ntext)); | 314 isolateToDartDOMDataMap().set(isolate, new DartDOMData(applicationLoader, co
ntext)); |
| 310 ASSERT(context->isDocument()); | 315 ASSERT(context->isDocument()); |
| 311 } | 316 } |
| 312 | 317 |
| 313 void DartUtilities::registerPureIsolate(Dart_Isolate isolate, PassRefPtr<DartApp
licationLoader> applicationLoader) | 318 void DartUtilities::registerPureIsolate(Dart_Isolate isolate, PassRefPtr<DartApp
licationLoader> applicationLoader) |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 ASSERT(!Dart_IsError(library)); | 481 ASSERT(!Dart_IsError(library)); |
| 477 Dart_Handle args[2] = {0}; | 482 Dart_Handle args[2] = {0}; |
| 478 args[0] = Dart_NewString(fileName); | 483 args[0] = Dart_NewString(fileName); |
| 479 args[1] = Dart_NewInteger(lineNumber); | 484 args[1] = Dart_NewInteger(lineNumber); |
| 480 Dart_Handle result = Dart_InvokeStatic(library, Dart_NewString("Utils"), Dar
t_NewString("makeNotImplementedException"), 2, args); | 485 Dart_Handle result = Dart_InvokeStatic(library, Dart_NewString("Utils"), Dar
t_NewString("makeNotImplementedException"), 2, args); |
| 481 ASSERT(!Dart_IsError(result)); | 486 ASSERT(!Dart_IsError(result)); |
| 482 return result; | 487 return result; |
| 483 } | 488 } |
| 484 | 489 |
| 485 } | 490 } |
| OLD | NEW |