Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: Source/bindings/dart/DartApplicationLoader.cpp

Issue 503903003: Cherry-pick "Fix for issue 20605, set the application loader state back to running when all the def… (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/2062
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 261
262 void DartApplicationLoader::load(PassRefPtr<DartErrorEventDispatcher> errorEvent Dispatcher) 262 void DartApplicationLoader::load(PassRefPtr<DartErrorEventDispatcher> errorEvent Dispatcher)
263 { 263 {
264 RELEASE_ASSERT(m_state == Ready || m_state == DeferredReady); 264 RELEASE_ASSERT(m_state == Ready || m_state == DeferredReady);
265 265
266 m_errorEventDispatcher = errorEventDispatcher; 266 m_errorEventDispatcher = errorEventDispatcher;
267 267
268 DartIsolateScope isolateScope(m_isolate); 268 DartIsolateScope isolateScope(m_isolate);
269 DartApiScope dartApiScope; 269 DartApiScope dartApiScope;
270 bool completeFutures = false;
270 271
271 // Indicate to the VM that all outstanding load requests are done. This 272 // Finalize classes and complete futures if there are any deferred loads.
272 // call will finalize all the classes loaded so far and complete all 273 if (!m_mainInvoked) {
273 // deferred library load futures. 274 RELEASE_ASSERT(m_state == Ready);
275 } else {
276 // We have already invoked the entry point on the main script URL at
277 // this point we will start running dart code again.
278 RELEASE_ASSERT(m_state == DeferredReady);
279 m_state = Running;
280 completeFutures = true;
281 }
274 { 282 {
275 V8Scope v8scope(DartDOMData::current()); 283 V8Scope v8scope(DartDOMData::current());
276 Dart_Handle result = Dart_FinalizeLoading(true); 284 Dart_Handle result = Dart_FinalizeLoading(completeFutures);
277 if (Dart_IsError(result)) { 285 if (Dart_IsError(result)) {
278 reportDartError(result); 286 reportDartError(result);
279 return; 287 return;
280 } 288 }
281 } 289 }
282
283 // Invoke the entry point on the main script URL if it has not yet been 290 // Invoke the entry point on the main script URL if it has not yet been
284 // invoked. 291 // invoked.
285 if (!m_mainInvoked) { 292 if (!m_mainInvoked) {
286 RELEASE_ASSERT(m_state == Ready);
287 // Call the entry point on the main script URL. 293 // Call the entry point on the main script URL.
288 callEntryPoint(); 294 callEntryPoint();
289 } 295 }
290 } 296 }
291 297
292 void DartApplicationLoader::loadScriptFromSnapshot(const String& url, const uint 8_t* snapshot, intptr_t snapshotSize) 298 void DartApplicationLoader::loadScriptFromSnapshot(const String& url, const uint 8_t* snapshot, intptr_t snapshotSize)
293 { 299 {
294 // FIXME(vsm): State? 300 // FIXME(vsm): State?
295 301
296 Timeline timeline(m_originDocument->frame(), String("loadSnapshot@") + m_scr iptUrlString); 302 Timeline timeline(m_originDocument->frame(), String("loadSnapshot@") + m_scr iptUrlString);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 void DartApplicationLoader::reportError(const String& error, const String& url) 629 void DartApplicationLoader::reportError(const String& error, const String& url)
624 { 630 {
625 if (m_state < Running) 631 if (m_state < Running)
626 m_state = Error; 632 m_state = Error;
627 m_error = true; 633 m_error = true;
628 m_loadCallback->reportError(error, url); 634 m_loadCallback->reportError(error, url);
629 } 635 }
630 636
631 637
632 } 638 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698