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