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 "output stream" ("output" from the point of view of the client -- | 6 // like an "output stream" ("output" from the point of view of the client -- |
7 // i.e., the client can write/stream output to it, but not read or seek). | 7 // i.e., the client can write/stream output to it, but not read or seek). |
8 | 8 |
9 #ifndef MOJO_SERVICES_FILES_PUBLIC_CPP_OUTPUT_STREAM_FILE_H_ | 9 #ifndef MOJO_SERVICES_FILES_CPP_OUTPUT_STREAM_FILE_H_ |
10 #define MOJO_SERVICES_FILES_PUBLIC_CPP_OUTPUT_STREAM_FILE_H_ | 10 #define MOJO_SERVICES_FILES_CPP_OUTPUT_STREAM_FILE_H_ |
11 | 11 |
12 #include <stddef.h> | 12 #include <stddef.h> |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
17 #include "mojo/public/cpp/bindings/interface_request.h" | 17 #include "mojo/public/cpp/bindings/interface_request.h" |
18 #include "mojo/public/cpp/system/macros.h" | 18 #include "mojo/public/cpp/system/macros.h" |
19 #include "mojo/services/files/public/interfaces/file.mojom.h" | 19 #include "mojo/services/files/interfaces/file.mojom.h" |
20 #include "mojo/services/files/public/interfaces/types.mojom.h" | 20 #include "mojo/services/files/interfaces/types.mojom.h" |
21 | 21 |
22 namespace files_impl { | 22 namespace files_impl { |
23 | 23 |
24 class OutputStreamFile : public mojo::files::File { | 24 class OutputStreamFile : public mojo::files::File { |
25 public: | 25 public: |
26 // The |Client| receives data written to the stream "file" as well as other | 26 // The |Client| receives data written to the stream "file" as well as other |
27 // notifications (e.g., of the "file" being closed). From any of the methods | 27 // notifications (e.g., of the "file" being closed). From any of the methods |
28 // below, the client may choose to destroy the |OutputStreamFile|. | 28 // below, the client may choose to destroy the |OutputStreamFile|. |
29 class Client { | 29 class Client { |
30 public: | 30 public: |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 Client* client_; | 104 Client* client_; |
105 bool is_closed_; | 105 bool is_closed_; |
106 | 106 |
107 mojo::Binding<mojo::files::File> binding_; | 107 mojo::Binding<mojo::files::File> binding_; |
108 | 108 |
109 MOJO_DISALLOW_COPY_AND_ASSIGN(OutputStreamFile); | 109 MOJO_DISALLOW_COPY_AND_ASSIGN(OutputStreamFile); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace files_impl | 112 } // namespace files_impl |
113 | 113 |
114 #endif // MOJO_SERVICES_FILES_PUBLIC_CPP_OUTPUT_STREAM_FILE_H_ | 114 #endif // MOJO_SERVICES_FILES_CPP_OUTPUT_STREAM_FILE_H_ |
OLD | NEW |