| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 m_maxRunningReaders(kMaxOutstandingRequestsPerThread) {} | 129 m_maxRunningReaders(kMaxOutstandingRequestsPerThread) {} |
| 130 | 130 |
| 131 void pushReader(FileReader* reader) { | 131 void pushReader(FileReader* reader) { |
| 132 if (m_pendingReaders.isEmpty() && | 132 if (m_pendingReaders.isEmpty() && |
| 133 m_runningReaders.size() < m_maxRunningReaders) { | 133 m_runningReaders.size() < m_maxRunningReaders) { |
| 134 reader->executePendingRead(); | 134 reader->executePendingRead(); |
| 135 ASSERT(!m_runningReaders.contains(reader)); | 135 ASSERT(!m_runningReaders.contains(reader)); |
| 136 m_runningReaders.insert(reader); | 136 m_runningReaders.insert(reader); |
| 137 return; | 137 return; |
| 138 } | 138 } |
| 139 m_pendingReaders.append(reader); | 139 m_pendingReaders.push_back(reader); |
| 140 executeReaders(); | 140 executeReaders(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 FinishReaderType removeReader(FileReader* reader) { | 143 FinishReaderType removeReader(FileReader* reader) { |
| 144 FileReaderHashSet::const_iterator hashIter = m_runningReaders.find(reader); | 144 FileReaderHashSet::const_iterator hashIter = m_runningReaders.find(reader); |
| 145 if (hashIter != m_runningReaders.end()) { | 145 if (hashIter != m_runningReaders.end()) { |
| 146 m_runningReaders.erase(hashIter); | 146 m_runningReaders.erase(hashIter); |
| 147 return RunPendingReaders; | 147 return RunPendingReaders; |
| 148 } | 148 } |
| 149 FileReaderDeque::const_iterator dequeEnd = m_pendingReaders.end(); | 149 FileReaderDeque::const_iterator dequeEnd = m_pendingReaders.end(); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0)); | 466 ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0)); |
| 467 } | 467 } |
| 468 | 468 |
| 469 DEFINE_TRACE(FileReader) { | 469 DEFINE_TRACE(FileReader) { |
| 470 visitor->trace(m_error); | 470 visitor->trace(m_error); |
| 471 EventTargetWithInlineData::trace(visitor); | 471 EventTargetWithInlineData::trace(visitor); |
| 472 ContextLifecycleObserver::trace(visitor); | 472 ContextLifecycleObserver::trace(visitor); |
| 473 } | 473 } |
| 474 | 474 |
| 475 } // namespace blink | 475 } // namespace blink |
| OLD | NEW |