| OLD | NEW |
| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 using FileReaderDeque = PersistentHeapDequeWillBeHeapDeque<Member<FileReader
>>; | 190 using FileReaderDeque = PersistentHeapDequeWillBeHeapDeque<Member<FileReader
>>; |
| 191 using FileReaderHashSet = PersistentHeapHashSetWillBeHeapHashSet<Member<File
Reader>>; | 191 using FileReaderHashSet = PersistentHeapHashSetWillBeHeapHashSet<Member<File
Reader>>; |
| 192 | 192 |
| 193 FileReaderDeque m_pendingReaders; | 193 FileReaderDeque m_pendingReaders; |
| 194 FileReaderHashSet m_runningReaders; | 194 FileReaderHashSet m_runningReaders; |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 FileReader* FileReader::create(ExecutionContext* context) | 197 FileReader* FileReader::create(ExecutionContext* context) |
| 198 { | 198 { |
| 199 FileReader* fileReader = new FileReader(context); | 199 return new FileReader(context); |
| 200 fileReader->suspendIfNeeded(); | |
| 201 return fileReader; | |
| 202 } | 200 } |
| 203 | 201 |
| 204 FileReader::FileReader(ExecutionContext* context) | 202 FileReader::FileReader(ExecutionContext* context) |
| 205 : ActiveDOMObject(context) | 203 : ContextLifecycleObserver(context) |
| 206 , m_state(EMPTY) | 204 , m_state(EMPTY) |
| 207 , m_loadingState(LoadingStateNone) | 205 , m_loadingState(LoadingStateNone) |
| 208 , m_readType(FileReaderLoader::ReadAsBinaryString) | 206 , m_readType(FileReaderLoader::ReadAsBinaryString) |
| 209 , m_lastProgressNotificationTimeMS(0) | 207 , m_lastProgressNotificationTimeMS(0) |
| 210 , m_asyncOperationId(0) | 208 , m_asyncOperationId(0) |
| 211 { | 209 { |
| 212 } | 210 } |
| 213 | 211 |
| 214 FileReader::~FileReader() | 212 FileReader::~FileReader() |
| 215 { | 213 { |
| 216 terminate(); | 214 terminate(); |
| 217 } | 215 } |
| 218 | 216 |
| 219 const AtomicString& FileReader::interfaceName() const | 217 const AtomicString& FileReader::interfaceName() const |
| 220 { | 218 { |
| 221 return EventTargetNames::FileReader; | 219 return EventTargetNames::FileReader; |
| 222 } | 220 } |
| 223 | 221 |
| 224 void FileReader::stop() | 222 void FileReader::contextDestroyed() |
| 225 { | 223 { |
| 226 // The delayed abort task tidies up and advances to the DONE state. | 224 // The delayed abort task tidies up and advances to the DONE state. |
| 227 if (m_loadingState == LoadingStateAborted) | 225 if (m_loadingState == LoadingStateAborted) |
| 228 return; | 226 return; |
| 229 | 227 |
| 230 if (hasPendingActivity()) | 228 if (hasPendingActivity()) |
| 231 ThrottlingController::finishReader(executionContext(), this, ThrottlingC
ontroller::removeReader(executionContext(), this)); | 229 ThrottlingController::finishReader(executionContext(), this, ThrottlingC
ontroller::removeReader(executionContext(), this)); |
| 232 terminate(); | 230 terminate(); |
| 233 } | 231 } |
| 234 | 232 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 else | 462 else |
| 465 dispatchEvent(ProgressEvent::create(type, false, m_loader->bytesLoaded()
, 0)); | 463 dispatchEvent(ProgressEvent::create(type, false, m_loader->bytesLoaded()
, 0)); |
| 466 | 464 |
| 467 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 465 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
| 468 } | 466 } |
| 469 | 467 |
| 470 DEFINE_TRACE(FileReader) | 468 DEFINE_TRACE(FileReader) |
| 471 { | 469 { |
| 472 visitor->trace(m_error); | 470 visitor->trace(m_error); |
| 473 RefCountedGarbageCollectedEventTargetWithInlineData<FileReader>::trace(visit
or); | 471 RefCountedGarbageCollectedEventTargetWithInlineData<FileReader>::trace(visit
or); |
| 474 ActiveDOMObject::trace(visitor); | 472 ContextLifecycleObserver::trace(visitor); |
| 475 } | 473 } |
| 476 | 474 |
| 477 } // namespace blink | 475 } // namespace blink |
| OLD | NEW |