Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chromeos/dbus/pipe_reader.h

Issue 2081153002: No dbus::FileDescriptor in DebugDaemonClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/dbus/lorgnette_manager_client.cc ('k') | chromeos/dbus/pipe_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROMEOS_DBUS_PIPE_READER_H_ 5 #ifndef CHROMEOS_DBUS_PIPE_READER_H_
6 #define CHROMEOS_DBUS_PIPE_READER_H_ 6 #define CHROMEOS_DBUS_PIPE_READER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/files/file.h" 12 #include "base/files/scoped_file.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "chromeos/chromeos_export.h" 16 #include "chromeos/chromeos_export.h"
17 17
18 namespace base { 18 namespace base {
19 class TaskRunner; 19 class TaskRunner;
20 } 20 }
21 21
22 namespace net { 22 namespace net {
(...skipping 17 matching lines...) Expand all
40 40
41 PipeReader(const scoped_refptr<base::TaskRunner>& task_runner, 41 PipeReader(const scoped_refptr<base::TaskRunner>& task_runner,
42 const IOCompleteCallback& callback); 42 const IOCompleteCallback& callback);
43 virtual ~PipeReader(); 43 virtual ~PipeReader();
44 44
45 // Starts data collection. 45 // Starts data collection.
46 // Returns the write end of the pipe if stream was setup correctly. 46 // Returns the write end of the pipe if stream was setup correctly.
47 // On success data will automatically be accumulated into a string that 47 // On success data will automatically be accumulated into a string that
48 // can be retrieved with PipeReader::data(). To shutdown collection delete 48 // can be retrieved with PipeReader::data(). To shutdown collection delete
49 // the instance and/or use PipeReader::OnDataReady(-1). 49 // the instance and/or use PipeReader::OnDataReady(-1).
50 base::File StartIO(); 50 base::ScopedFD StartIO();
51 51
52 // Called when pipe data are available. Can also be used to shutdown 52 // Called when pipe data are available. Can also be used to shutdown
53 // data collection by passing -1 for |byte_count|. 53 // data collection by passing -1 for |byte_count|.
54 void OnDataReady(int byte_count); 54 void OnDataReady(int byte_count);
55 55
56 // Virtual function that subclasses will override in order to deal 56 // Virtual function that subclasses will override in order to deal
57 // with incoming data. 57 // with incoming data.
58 virtual void AcceptData(const char *data, int length) = 0; 58 virtual void AcceptData(const char *data, int length) = 0;
59 59
60 private: 60 private:
(...skipping 22 matching lines...) Expand all
83 83
84 private: 84 private:
85 std::string data_; 85 std::string data_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(PipeReaderForString); 87 DISALLOW_COPY_AND_ASSIGN(PipeReaderForString);
88 }; 88 };
89 89
90 } // namespace chromeos 90 } // namespace chromeos
91 91
92 #endif // CHROMEOS_DBUS_PIPE_READER_H_ 92 #endif // CHROMEOS_DBUS_PIPE_READER_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/lorgnette_manager_client.cc ('k') | chromeos/dbus/pipe_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698