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

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/DirectoryReaderSync.cpp

Issue 2040563002: Remove FileError interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fe-dep
Patch Set: handleEvent -> invoke and other review nits Created 4 years, 5 months 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 19 matching lines...) Expand all
30 30
31 #include "modules/filesystem/DirectoryReaderSync.h" 31 #include "modules/filesystem/DirectoryReaderSync.h"
32 32
33 #include "bindings/core/v8/ExceptionState.h" 33 #include "bindings/core/v8/ExceptionState.h"
34 #include "modules/filesystem/DirectoryEntry.h" 34 #include "modules/filesystem/DirectoryEntry.h"
35 #include "modules/filesystem/DirectoryEntrySync.h" 35 #include "modules/filesystem/DirectoryEntrySync.h"
36 #include "modules/filesystem/EntriesCallback.h" 36 #include "modules/filesystem/EntriesCallback.h"
37 #include "modules/filesystem/EntrySync.h" 37 #include "modules/filesystem/EntrySync.h"
38 #include "modules/filesystem/ErrorCallback.h" 38 #include "modules/filesystem/ErrorCallback.h"
39 #include "modules/filesystem/FileEntrySync.h" 39 #include "modules/filesystem/FileEntrySync.h"
40 #include "modules/filesystem/FileSystemCallbacks.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 class DirectoryReaderSync::EntriesCallbackHelper final : public EntriesCallback { 44 class DirectoryReaderSync::EntriesCallbackHelper final : public EntriesCallback {
44 public: 45 public:
45 explicit EntriesCallbackHelper(DirectoryReaderSync* reader) 46 explicit EntriesCallbackHelper(DirectoryReaderSync* reader)
46 : m_reader(reader) 47 : m_reader(reader)
47 { 48 {
48 } 49 }
49 50
50 void handleEvent(const EntryHeapVector& entries) override 51 void handleEvent(const EntryHeapVector& entries) override
51 { 52 {
52 EntrySyncHeapVector syncEntries; 53 EntrySyncHeapVector syncEntries;
53 syncEntries.reserveInitialCapacity(entries.size()); 54 syncEntries.reserveInitialCapacity(entries.size());
54 for (size_t i = 0; i < entries.size(); ++i) 55 for (size_t i = 0; i < entries.size(); ++i)
55 syncEntries.uncheckedAppend(EntrySync::create(entries[i].get())); 56 syncEntries.uncheckedAppend(EntrySync::create(entries[i].get()));
56 m_reader->addEntries(syncEntries); 57 m_reader->addEntries(syncEntries);
57 } 58 }
58 59
59 DEFINE_INLINE_VIRTUAL_TRACE() 60 DEFINE_INLINE_VIRTUAL_TRACE()
60 { 61 {
61 visitor->trace(m_reader); 62 visitor->trace(m_reader);
62 EntriesCallback::trace(visitor); 63 EntriesCallback::trace(visitor);
63 } 64 }
64 65
65 private: 66 private:
66 Member<DirectoryReaderSync> m_reader; 67 Member<DirectoryReaderSync> m_reader;
67 }; 68 };
68 69
69 class DirectoryReaderSync::ErrorCallbackHelper final : public ErrorCallback { 70 class DirectoryReaderSync::ErrorCallbackHelper final : public ErrorCallbackBase {
70 public: 71 public:
71 explicit ErrorCallbackHelper(DirectoryReaderSync* reader) 72 explicit ErrorCallbackHelper(DirectoryReaderSync* reader)
72 : m_reader(reader) 73 : m_reader(reader)
73 { 74 {
74 } 75 }
75 76
76 void handleEvent(FileError* error) override 77 void invoke(FileError::ErrorCode error) override
77 { 78 {
78 m_reader->setError(error->code()); 79 m_reader->setError(error);
79 } 80 }
80 81
81 DEFINE_INLINE_VIRTUAL_TRACE() 82 DEFINE_INLINE_VIRTUAL_TRACE()
82 { 83 {
83 visitor->trace(m_reader); 84 visitor->trace(m_reader);
84 ErrorCallback::trace(visitor); 85 ErrorCallbackBase::trace(visitor);
85 } 86 }
86 87
87 private: 88 private:
88 Member<DirectoryReaderSync> m_reader; 89 Member<DirectoryReaderSync> m_reader;
89 }; 90 };
90 91
91 DirectoryReaderSync::DirectoryReaderSync(DOMFileSystemBase* fileSystem, const St ring& fullPath) 92 DirectoryReaderSync::DirectoryReaderSync(DOMFileSystemBase* fileSystem, const St ring& fullPath)
92 : DirectoryReaderBase(fileSystem, fullPath) 93 : DirectoryReaderBase(fileSystem, fullPath)
93 , m_callbacksId(0) 94 , m_callbacksId(0)
94 , m_errorCode(FileError::OK) 95 , m_errorCode(FileError::OK)
(...skipping 23 matching lines...) Expand all
118 return result; 119 return result;
119 } 120 }
120 121
121 DEFINE_TRACE(DirectoryReaderSync) 122 DEFINE_TRACE(DirectoryReaderSync)
122 { 123 {
123 visitor->trace(m_entries); 124 visitor->trace(m_entries);
124 DirectoryReaderBase::trace(visitor); 125 DirectoryReaderBase::trace(visitor);
125 } 126 }
126 127
127 } // namespace blink 128 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698