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 21 matching lines...) Expand all Loading... |
32 #define AsyncFileSystemCallbacks_h | 32 #define AsyncFileSystemCallbacks_h |
33 | 33 |
34 #include "platform/FileMetadata.h" | 34 #include "platform/FileMetadata.h" |
35 #include "platform/FileSystemType.h" | 35 #include "platform/FileSystemType.h" |
36 #include "platform/blob/BlobData.h" | 36 #include "platform/blob/BlobData.h" |
37 #include "public/platform/WebFileWriter.h" | 37 #include "public/platform/WebFileWriter.h" |
38 #include "wtf/Allocator.h" | 38 #include "wtf/Allocator.h" |
39 #include "wtf/Assertions.h" | 39 #include "wtf/Assertions.h" |
40 #include "wtf/Noncopyable.h" | 40 #include "wtf/Noncopyable.h" |
41 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 42 #include <memory> |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 class PLATFORM_EXPORT AsyncFileSystemCallbacks { | 46 class PLATFORM_EXPORT AsyncFileSystemCallbacks { |
46 USING_FAST_MALLOC(AsyncFileSystemCallbacks); | 47 USING_FAST_MALLOC(AsyncFileSystemCallbacks); |
47 WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks); | 48 WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks); |
48 public: | 49 public: |
49 AsyncFileSystemCallbacks() : m_blockUntilCompletion(false) { } | 50 AsyncFileSystemCallbacks() : m_blockUntilCompletion(false) { } |
50 | 51 |
51 // Called when a requested operation is completed successfully. | 52 // Called when a requested operation is completed successfully. |
(...skipping 11 matching lines...) Expand all Loading... |
63 // Called when a snapshot file is created successfully. | 64 // Called when a snapshot file is created successfully. |
64 virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataH
andle> snapshot) { ASSERT_NOT_REACHED(); } | 65 virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataH
andle> snapshot) { ASSERT_NOT_REACHED(); } |
65 | 66 |
66 // Called when a directory entry is read. | 67 // Called when a directory entry is read. |
67 virtual void didReadDirectoryEntry(const String& name, bool isDirectory) { A
SSERT_NOT_REACHED(); } | 68 virtual void didReadDirectoryEntry(const String& name, bool isDirectory) { A
SSERT_NOT_REACHED(); } |
68 | 69 |
69 // Called after a chunk of directory entries have been read (i.e. indicates
it's good time to call back to the application). If hasMore is true there can be
more chunks. | 70 // Called after a chunk of directory entries have been read (i.e. indicates
it's good time to call back to the application). If hasMore is true there can be
more chunks. |
70 virtual void didReadDirectoryEntries(bool hasMore) { ASSERT_NOT_REACHED(); } | 71 virtual void didReadDirectoryEntries(bool hasMore) { ASSERT_NOT_REACHED(); } |
71 | 72 |
72 // Called when an AsyncFileWrter has been created successfully. | 73 // Called when an AsyncFileWrter has been created successfully. |
73 virtual void didCreateFileWriter(PassOwnPtr<WebFileWriter>, long long length
) { ASSERT_NOT_REACHED(); } | 74 virtual void didCreateFileWriter(std::unique_ptr<WebFileWriter>, long long l
ength) { ASSERT_NOT_REACHED(); } |
74 | 75 |
75 // Called when there was an error. | 76 // Called when there was an error. |
76 virtual void didFail(int code) = 0; | 77 virtual void didFail(int code) = 0; |
77 | 78 |
78 // Returns true if the caller expects that the calling thread blocks | 79 // Returns true if the caller expects that the calling thread blocks |
79 // until completion. | 80 // until completion. |
80 virtual bool shouldBlockUntilCompletion() const | 81 virtual bool shouldBlockUntilCompletion() const |
81 { | 82 { |
82 return m_blockUntilCompletion; | 83 return m_blockUntilCompletion; |
83 } | 84 } |
84 | 85 |
85 void setShouldBlockUntilCompletion(bool flag) | 86 void setShouldBlockUntilCompletion(bool flag) |
86 { | 87 { |
87 m_blockUntilCompletion = flag; | 88 m_blockUntilCompletion = flag; |
88 } | 89 } |
89 | 90 |
90 virtual ~AsyncFileSystemCallbacks() { } | 91 virtual ~AsyncFileSystemCallbacks() { } |
91 | 92 |
92 private: | 93 private: |
93 bool m_blockUntilCompletion; | 94 bool m_blockUntilCompletion; |
94 }; | 95 }; |
95 | 96 |
96 } // namespace blink | 97 } // namespace blink |
97 | 98 |
98 #endif // AsyncFileSystemCallbacks_h | 99 #endif // AsyncFileSystemCallbacks_h |
OLD | NEW |