| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BytesConsumer_h | 5 #ifndef BytesConsumer_h |
| 6 #define BytesConsumer_h | 6 #define BytesConsumer_h |
| 7 | 7 |
| 8 #include "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
| 9 #include "platform/blob/BlobData.h" | 9 #include "platform/blob/BlobData.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 bool operator ==(const Error& e) const { return e.m_message == m_message
; } | 49 bool operator ==(const Error& e) const { return e.m_message == m_message
; } |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 String m_message; | 52 String m_message; |
| 53 }; | 53 }; |
| 54 // Client gets notification from the associated ByteConsumer. | 54 // Client gets notification from the associated ByteConsumer. |
| 55 class MODULES_EXPORT Client : public GarbageCollectedMixin { | 55 class MODULES_EXPORT Client : public GarbageCollectedMixin { |
| 56 public: | 56 public: |
| 57 virtual ~Client() {} | 57 virtual ~Client() {} |
| 58 | 58 |
| 59 // This function is called when the state changes. This function can | 59 // This function is called when the state changes (e.g., readable => |
| 60 // be called more than needed, i.e., it can be called even when the | 60 // errored). This function can be called more than needed, i.e., it can |
| 61 // state is not actually changed. | 61 // be called even when the state is not actually changed, but it is |
| 62 // guaranteed that this function cannot be called after the state |
| 63 // becomes closed or errored. |
| 62 // | 64 // |
| 63 // This function is not called when the state change is trigerred by | 65 // This function is not called when the state change is trigerred by |
| 64 // public methods called by a user. For example, when a user reads | 66 // public methods called by a user. For example, when a user reads |
| 65 // data by |read| and the state changes from waiting to readable, this | 67 // data by |read| and the state changes from waiting to readable, this |
| 66 // function will not be called. | 68 // function will not be called. |
| 67 virtual void onStateChange() = 0; | 69 virtual void onStateChange() = 0; |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 virtual ~BytesConsumer() {} | 72 virtual ~BytesConsumer() {} |
| 71 | 73 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return PublicState::Errored; | 163 return PublicState::Errored; |
| 162 } | 164 } |
| 163 NOTREACHED(); | 165 NOTREACHED(); |
| 164 return PublicState::ReadableOrWaiting; | 166 return PublicState::ReadableOrWaiting; |
| 165 } | 167 } |
| 166 }; | 168 }; |
| 167 | 169 |
| 168 } // namespace blink | 170 } // namespace blink |
| 169 | 171 |
| 170 #endif // BytesConsumer_h | 172 #endif // BytesConsumer_h |
| OLD | NEW |