| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 if (m_entriesCallback) { | 96 if (m_entriesCallback) { |
| 97 // Non-null m_entriesCallback means multiple readEntries() calls are made | 97 // Non-null m_entriesCallback means multiple readEntries() calls are made |
| 98 // concurrently. We don't allow doing it. | 98 // concurrently. We don't allow doing it. |
| 99 filesystem()->reportError(ScriptErrorCallback::wrap(errorCallback), | 99 filesystem()->reportError(ScriptErrorCallback::wrap(errorCallback), |
| 100 FileError::kInvalidStateErr); | 100 FileError::kInvalidStateErr); |
| 101 return; | 101 return; |
| 102 } | 102 } |
| 103 | 103 |
| 104 if (!m_hasMoreEntries || !m_entries.isEmpty()) { | 104 if (!m_hasMoreEntries || !m_entries.isEmpty()) { |
| 105 if (entriesCallback) | 105 if (entriesCallback) { |
| 106 DOMFileSystem::scheduleCallback( | 106 DOMFileSystem::scheduleCallback( |
| 107 filesystem()->getExecutionContext(), | 107 filesystem()->getExecutionContext(), |
| 108 createSameThreadTask(&EntriesCallback::handleEvent, | 108 WTF::bind(&EntriesCallback::handleEvent, |
| 109 wrapPersistent(entriesCallback), | 109 wrapPersistent(entriesCallback), |
| 110 PersistentHeapVector<Member<Entry>>(m_entries))); | 110 PersistentHeapVector<Member<Entry>>(m_entries))); |
| 111 } |
| 111 m_entries.clear(); | 112 m_entries.clear(); |
| 112 return; | 113 return; |
| 113 } | 114 } |
| 114 | 115 |
| 115 m_entriesCallback = entriesCallback; | 116 m_entriesCallback = entriesCallback; |
| 116 m_errorCallback = errorCallback; | 117 m_errorCallback = errorCallback; |
| 117 } | 118 } |
| 118 | 119 |
| 119 void DirectoryReader::addEntries(const EntryHeapVector& entries) { | 120 void DirectoryReader::addEntries(const EntryHeapVector& entries) { |
| 120 m_entries.appendVector(entries); | 121 m_entries.appendVector(entries); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 135 } | 136 } |
| 136 | 137 |
| 137 DEFINE_TRACE(DirectoryReader) { | 138 DEFINE_TRACE(DirectoryReader) { |
| 138 visitor->trace(m_entries); | 139 visitor->trace(m_entries); |
| 139 visitor->trace(m_entriesCallback); | 140 visitor->trace(m_entriesCallback); |
| 140 visitor->trace(m_errorCallback); | 141 visitor->trace(m_errorCallback); |
| 141 DirectoryReaderBase::trace(visitor); | 142 DirectoryReaderBase::trace(visitor); |
| 142 } | 143 } |
| 143 | 144 |
| 144 } // namespace blink | 145 } // namespace blink |
| OLD | NEW |