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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/FileReader.cpp

Issue 2584383002: Update comments about active DOM objects (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 void FileReader::didFinishLoading() { 399 void FileReader::didFinishLoading() {
400 if (m_loadingState == LoadingStateAborted) 400 if (m_loadingState == LoadingStateAborted)
401 return; 401 return;
402 ASSERT(m_loadingState == LoadingStateLoading); 402 ASSERT(m_loadingState == LoadingStateLoading);
403 403
404 // TODO(jochen): When we set m_state to DONE below, we still need to fire 404 // TODO(jochen): When we set m_state to DONE below, we still need to fire
405 // the load and loadend events. To avoid GC to collect this FileReader, we 405 // the load and loadend events. To avoid GC to collect this FileReader, we
406 // use this separate variable to keep the wrapper of this FileReader alive. 406 // use this separate variable to keep the wrapper of this FileReader alive.
407 // An alternative would be to keep any active DOM object alive that is on 407 // An alternative would be to keep any ActiveScriptWrappables alive that is on
408 // the stack. 408 // the stack.
409 AutoReset<bool> firingEvents(&m_stillFiringEvents, true); 409 AutoReset<bool> firingEvents(&m_stillFiringEvents, true);
410 410
411 // It's important that we change m_loadingState before firing any events 411 // It's important that we change m_loadingState before firing any events
412 // since any of the events could call abort(), which internally checks 412 // since any of the events could call abort(), which internally checks
413 // if we're still loading (therefore we need abort process) or not. 413 // if we're still loading (therefore we need abort process) or not.
414 m_loadingState = LoadingStateNone; 414 m_loadingState = LoadingStateNone;
415 415
416 fireEvent(EventTypeNames::progress); 416 fireEvent(EventTypeNames::progress);
417 417
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0)); 469 ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0));
470 } 470 }
471 471
472 DEFINE_TRACE(FileReader) { 472 DEFINE_TRACE(FileReader) {
473 visitor->trace(m_error); 473 visitor->trace(m_error);
474 EventTargetWithInlineData::trace(visitor); 474 EventTargetWithInlineData::trace(visitor);
475 SuspendableObject::trace(visitor); 475 SuspendableObject::trace(visitor);
476 } 476 }
477 477
478 } // namespace blink 478 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698