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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 class PLATFORM_EXPORT AsyncFileSystemCallbacks { | 46 class PLATFORM_EXPORT AsyncFileSystemCallbacks { |
47 USING_FAST_MALLOC(AsyncFileSystemCallbacks); | 47 USING_FAST_MALLOC(AsyncFileSystemCallbacks); |
48 WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks); | 48 WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks); |
49 | 49 |
50 public: | 50 public: |
51 AsyncFileSystemCallbacks() : block_until_completion_(false) {} | 51 AsyncFileSystemCallbacks() : block_until_completion_(false) {} |
52 | 52 |
53 // Called when a requested operation is completed successfully. | 53 // Called when a requested operation is completed successfully. |
54 virtual void DidSucceed() { ASSERT_NOT_REACHED(); } | 54 virtual void DidSucceed() { NOTREACHED(); } |
55 | 55 |
56 // Called when a requested file system is opened. | 56 // Called when a requested file system is opened. |
57 virtual void DidOpenFileSystem(const String& name, const KURL& root_url) { | 57 virtual void DidOpenFileSystem(const String& name, const KURL& root_url) { |
58 ASSERT_NOT_REACHED(); | 58 NOTREACHED(); |
59 } | 59 } |
60 | 60 |
61 // Called when a filesystem URL is resolved. | 61 // Called when a filesystem URL is resolved. |
62 virtual void DidResolveURL(const String& name, | 62 virtual void DidResolveURL(const String& name, |
63 const KURL& root_url, | 63 const KURL& root_url, |
64 FileSystemType, | 64 FileSystemType, |
65 const String& file_path, | 65 const String& file_path, |
66 bool is_directory) { | 66 bool is_directory) { |
67 ASSERT_NOT_REACHED(); | 67 NOTREACHED(); |
68 } | 68 } |
69 | 69 |
70 // Called when a file metadata is read successfully. | 70 // Called when a file metadata is read successfully. |
71 virtual void DidReadMetadata(const FileMetadata&) { ASSERT_NOT_REACHED(); } | 71 virtual void DidReadMetadata(const FileMetadata&) { NOTREACHED(); } |
72 | 72 |
73 // Called when a snapshot file is created successfully. | 73 // Called when a snapshot file is created successfully. |
74 virtual void DidCreateSnapshotFile(const FileMetadata&, | 74 virtual void DidCreateSnapshotFile(const FileMetadata&, |
75 PassRefPtr<BlobDataHandle> snapshot) { | 75 PassRefPtr<BlobDataHandle> snapshot) { |
76 ASSERT_NOT_REACHED(); | 76 NOTREACHED(); |
77 } | 77 } |
78 | 78 |
79 // Called when a directory entry is read. | 79 // Called when a directory entry is read. |
80 virtual void DidReadDirectoryEntry(const String& name, bool is_directory) { | 80 virtual void DidReadDirectoryEntry(const String& name, bool is_directory) { |
81 ASSERT_NOT_REACHED(); | 81 NOTREACHED(); |
82 } | 82 } |
83 | 83 |
84 // Called after a chunk of directory entries have been read (i.e. indicates | 84 // Called after a chunk of directory entries have been read (i.e. indicates |
85 // it's good time to call back to the application). If hasMore is true there | 85 // it's good time to call back to the application). If hasMore is true there |
86 // can be more chunks. | 86 // can be more chunks. |
87 virtual void DidReadDirectoryEntries(bool has_more) { ASSERT_NOT_REACHED(); } | 87 virtual void DidReadDirectoryEntries(bool has_more) { NOTREACHED(); } |
88 | 88 |
89 // Called when an AsyncFileWrter has been created successfully. | 89 // Called when an AsyncFileWrter has been created successfully. |
90 virtual void DidCreateFileWriter(std::unique_ptr<WebFileWriter>, | 90 virtual void DidCreateFileWriter(std::unique_ptr<WebFileWriter>, |
91 long long length) { | 91 long long length) { |
92 ASSERT_NOT_REACHED(); | 92 NOTREACHED(); |
93 } | 93 } |
94 | 94 |
95 // Called when there was an error. | 95 // Called when there was an error. |
96 virtual void DidFail(int code) = 0; | 96 virtual void DidFail(int code) = 0; |
97 | 97 |
98 // Returns true if the caller expects that the calling thread blocks | 98 // Returns true if the caller expects that the calling thread blocks |
99 // until completion. | 99 // until completion. |
100 virtual bool ShouldBlockUntilCompletion() const { | 100 virtual bool ShouldBlockUntilCompletion() const { |
101 return block_until_completion_; | 101 return block_until_completion_; |
102 } | 102 } |
103 | 103 |
104 void SetShouldBlockUntilCompletion(bool flag) { | 104 void SetShouldBlockUntilCompletion(bool flag) { |
105 block_until_completion_ = flag; | 105 block_until_completion_ = flag; |
106 } | 106 } |
107 | 107 |
108 virtual ~AsyncFileSystemCallbacks() {} | 108 virtual ~AsyncFileSystemCallbacks() {} |
109 | 109 |
110 private: | 110 private: |
111 bool block_until_completion_; | 111 bool block_until_completion_; |
112 }; | 112 }; |
113 | 113 |
114 } // namespace blink | 114 } // namespace blink |
115 | 115 |
116 #endif // AsyncFileSystemCallbacks_h | 116 #endif // AsyncFileSystemCallbacks_h |
OLD | NEW |