OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This is a helper class for implementing a |mojo::files::File| that behaves | 5 // This is a helper class for implementing a |mojo::files::File| that behaves |
6 // like an "input stream" ("input" from the point of view of the client -- | 6 // like an "input stream" ("input" from the point of view of the client -- |
7 // i.e., the client can write/stream input from it, but not write or seek). | 7 // i.e., the client can write/stream input from it, but not write or seek). |
8 | 8 |
9 #ifndef MOJO_SERVICES_FILES_PUBLIC_CPP_INPUT_STREAM_FILE_H_ | 9 #ifndef MOJO_SERVICES_FILES_CPP_INPUT_STREAM_FILE_H_ |
10 #define MOJO_SERVICES_FILES_PUBLIC_CPP_INPUT_STREAM_FILE_H_ | 10 #define MOJO_SERVICES_FILES_CPP_INPUT_STREAM_FILE_H_ |
11 | 11 |
12 #include <stddef.h> | 12 #include <stddef.h> |
13 #include <stdint.h> | 13 #include <stdint.h> |
14 | 14 |
15 #include <deque> | 15 #include <deque> |
16 #include <memory> | 16 #include <memory> |
17 | 17 |
18 #include "mojo/public/cpp/bindings/array.h" | 18 #include "mojo/public/cpp/bindings/array.h" |
19 #include "mojo/public/cpp/bindings/binding.h" | 19 #include "mojo/public/cpp/bindings/binding.h" |
20 #include "mojo/public/cpp/bindings/callback.h" | 20 #include "mojo/public/cpp/bindings/callback.h" |
21 #include "mojo/public/cpp/bindings/interface_request.h" | 21 #include "mojo/public/cpp/bindings/interface_request.h" |
22 #include "mojo/public/cpp/system/macros.h" | 22 #include "mojo/public/cpp/system/macros.h" |
23 #include "mojo/services/files/public/interfaces/file.mojom.h" | 23 #include "mojo/services/files/interfaces/file.mojom.h" |
24 #include "mojo/services/files/public/interfaces/types.mojom.h" | 24 #include "mojo/services/files/interfaces/types.mojom.h" |
25 | 25 |
26 namespace files_impl { | 26 namespace files_impl { |
27 | 27 |
28 class InputStreamFile : public mojo::files::File { | 28 class InputStreamFile : public mojo::files::File { |
29 public: | 29 public: |
30 // The |Client| receives data written to the stream "file" as well as other | 30 // The |Client| receives data written to the stream "file" as well as other |
31 // notifications (e.g., of the "file" being closed). From any of the methods | 31 // notifications (e.g., of the "file" being closed). From any of the methods |
32 // below, the client may choose to destroy the |InputStreamFile|. | 32 // below, the client may choose to destroy the |InputStreamFile|. |
33 class Client { | 33 class Client { |
34 public: | 34 public: |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // If non-null |*was_destroyed_| is set to true on destruction. | 149 // If non-null |*was_destroyed_| is set to true on destruction. |
150 bool* was_destroyed_; | 150 bool* was_destroyed_; |
151 | 151 |
152 mojo::Binding<mojo::files::File> binding_; | 152 mojo::Binding<mojo::files::File> binding_; |
153 | 153 |
154 MOJO_DISALLOW_COPY_AND_ASSIGN(InputStreamFile); | 154 MOJO_DISALLOW_COPY_AND_ASSIGN(InputStreamFile); |
155 }; | 155 }; |
156 | 156 |
157 } // namespace files_impl | 157 } // namespace files_impl |
158 | 158 |
159 #endif // MOJO_SERVICES_FILES_PUBLIC_CPP_INPUT_STREAM_FILE_H_ | 159 #endif // MOJO_SERVICES_FILES_CPP_INPUT_STREAM_FILE_H_ |
OLD | NEW |