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> | |
43 | 42 |
44 namespace blink { | 43 namespace blink { |
45 | 44 |
46 class PLATFORM_EXPORT AsyncFileSystemCallbacks { | 45 class PLATFORM_EXPORT AsyncFileSystemCallbacks { |
47 USING_FAST_MALLOC(AsyncFileSystemCallbacks); | 46 USING_FAST_MALLOC(AsyncFileSystemCallbacks); |
48 WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks); | 47 WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks); |
49 public: | 48 public: |
50 AsyncFileSystemCallbacks() : m_blockUntilCompletion(false) { } | 49 AsyncFileSystemCallbacks() : m_blockUntilCompletion(false) { } |
51 | 50 |
52 // Called when a requested operation is completed successfully. | 51 // Called when a requested operation is completed successfully. |
(...skipping 11 matching lines...) Expand all Loading... |
64 // Called when a snapshot file is created successfully. | 63 // Called when a snapshot file is created successfully. |
65 virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataH
andle> snapshot) { ASSERT_NOT_REACHED(); } | 64 virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataH
andle> snapshot) { ASSERT_NOT_REACHED(); } |
66 | 65 |
67 // Called when a directory entry is read. | 66 // Called when a directory entry is read. |
68 virtual void didReadDirectoryEntry(const String& name, bool isDirectory) { A
SSERT_NOT_REACHED(); } | 67 virtual void didReadDirectoryEntry(const String& name, bool isDirectory) { A
SSERT_NOT_REACHED(); } |
69 | 68 |
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. | 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. |
71 virtual void didReadDirectoryEntries(bool hasMore) { ASSERT_NOT_REACHED(); } | 70 virtual void didReadDirectoryEntries(bool hasMore) { ASSERT_NOT_REACHED(); } |
72 | 71 |
73 // Called when an AsyncFileWrter has been created successfully. | 72 // Called when an AsyncFileWrter has been created successfully. |
74 virtual void didCreateFileWriter(std::unique_ptr<WebFileWriter>, long long l
ength) { ASSERT_NOT_REACHED(); } | 73 virtual void didCreateFileWriter(PassOwnPtr<WebFileWriter>, long long length
) { ASSERT_NOT_REACHED(); } |
75 | 74 |
76 // Called when there was an error. | 75 // Called when there was an error. |
77 virtual void didFail(int code) = 0; | 76 virtual void didFail(int code) = 0; |
78 | 77 |
79 // Returns true if the caller expects that the calling thread blocks | 78 // Returns true if the caller expects that the calling thread blocks |
80 // until completion. | 79 // until completion. |
81 virtual bool shouldBlockUntilCompletion() const | 80 virtual bool shouldBlockUntilCompletion() const |
82 { | 81 { |
83 return m_blockUntilCompletion; | 82 return m_blockUntilCompletion; |
84 } | 83 } |
85 | 84 |
86 void setShouldBlockUntilCompletion(bool flag) | 85 void setShouldBlockUntilCompletion(bool flag) |
87 { | 86 { |
88 m_blockUntilCompletion = flag; | 87 m_blockUntilCompletion = flag; |
89 } | 88 } |
90 | 89 |
91 virtual ~AsyncFileSystemCallbacks() { } | 90 virtual ~AsyncFileSystemCallbacks() { } |
92 | 91 |
93 private: | 92 private: |
94 bool m_blockUntilCompletion; | 93 bool m_blockUntilCompletion; |
95 }; | 94 }; |
96 | 95 |
97 } // namespace blink | 96 } // namespace blink |
98 | 97 |
99 #endif // AsyncFileSystemCallbacks_h | 98 #endif // AsyncFileSystemCallbacks_h |
OLD | NEW |