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 #ifndef SERVICES_NATIVE_SUPPORT_REDIRECTORS_H_ | 5 #ifndef SERVICES_NATIVE_SUPPORT_REDIRECTORS_H_ |
6 #define SERVICES_NATIVE_SUPPORT_REDIRECTORS_H_ | 6 #define SERVICES_NATIVE_SUPPORT_REDIRECTORS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "mojo/public/cpp/bindings/array.h" | 16 #include "mojo/public/cpp/bindings/array.h" |
17 #include "mojo/services/files/public/interfaces/file.mojom.h" | 17 #include "mojo/services/files/interfaces/file.mojom.h" |
18 #include "mojo/services/files/public/interfaces/types.mojom.h" | 18 #include "mojo/services/files/interfaces/types.mojom.h" |
19 | 19 |
20 namespace native_support { | 20 namespace native_support { |
21 | 21 |
22 // Reads from an FD (as possible without blocking) and writes the result to a | 22 // Reads from an FD (as possible without blocking) and writes the result to a |
23 // |mojo::files::File*|. This object must be used on an I/O thread. | 23 // |mojo::files::File*|. This object must be used on an I/O thread. |
24 class FDToMojoFileRedirector : public base::MessageLoopForIO::Watcher { | 24 class FDToMojoFileRedirector : public base::MessageLoopForIO::Watcher { |
25 public: | 25 public: |
26 // Both |fd| and |file| must outlive this object. | 26 // Both |fd| and |file| must outlive this object. |
27 FDToMojoFileRedirector(int fd, mojo::files::File* file, size_t buffer_size); | 27 FDToMojoFileRedirector(int fd, mojo::files::File* file, size_t buffer_size); |
28 ~FDToMojoFileRedirector() override; | 28 ~FDToMojoFileRedirector() override; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 bool read_pending_; | 75 bool read_pending_; |
76 | 76 |
77 base::WeakPtrFactory<MojoFileToFDRedirector> weak_factory_; | 77 base::WeakPtrFactory<MojoFileToFDRedirector> weak_factory_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(MojoFileToFDRedirector); | 79 DISALLOW_COPY_AND_ASSIGN(MojoFileToFDRedirector); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace native_support | 82 } // namespace native_support |
83 | 83 |
84 #endif // SERVICES_NATIVE_SUPPORT_REDIRECTORS_H_ | 84 #endif // SERVICES_NATIVE_SUPPORT_REDIRECTORS_H_ |
OLD | NEW |