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

Side by Side Diff: components/cast_channel/cast_transport.h

Issue 2913033003: [cast_channel] Move cast_channel related files from //extensions to //components (Closed)
Patch Set: Created 3 years, 6 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
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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TRANSPORT_H_ 5 #ifndef COMPONENTS_CAST_CHANNEL_CAST_TRANSPORT_H_
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TRANSPORT_H_ 6 #define COMPONENTS_CAST_CHANNEL_CAST_TRANSPORT_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "components/cast_channel/cast_channel_enum.h" 15 #include "components/cast_channel/cast_channel_enum.h"
16 #include "extensions/browser/api/cast_channel/logger.h" 16 #include "components/cast_channel/logger.h"
17 #include "extensions/common/api/cast_channel/logging.pb.h" 17 #include "components/cast_channel/proto/logging.pb.h"
18 #include "net/base/completion_callback.h" 18 #include "net/base/completion_callback.h"
19 #include "net/base/ip_endpoint.h" 19 #include "net/base/ip_endpoint.h"
20 20
21 namespace net { 21 namespace net {
22 class DrainableIOBuffer; 22 class DrainableIOBuffer;
23 class DrainableIOBuffer; 23 class DrainableIOBuffer;
24 class GrowableIOBuffer; 24 class GrowableIOBuffer;
25 class Socket; 25 class Socket;
26 } // namespace net 26 } // namespace net
27 27
28 namespace extensions {
29 namespace api {
30 namespace cast_channel { 28 namespace cast_channel {
31 class CastMessage; 29 class CastMessage;
32 class MessageFramer; 30 class MessageFramer;
33 31
34 class CastTransport { 32 class CastTransport {
35 public: 33 public:
36 virtual ~CastTransport() {} 34 virtual ~CastTransport() {}
37 35
38 // Object to be informed of incoming messages and read errors. 36 // Object to be informed of incoming messages and read errors.
39 class Delegate { 37 class Delegate {
(...skipping 27 matching lines...) Expand all
67 virtual void Start() = 0; 65 virtual void Start() = 0;
68 66
69 // Changes the delegate for processing read events. Pending reads remain 67 // Changes the delegate for processing read events. Pending reads remain
70 // in-flight. 68 // in-flight.
71 // Ownership of the pointee of |delegate| is assumed by the transport. 69 // Ownership of the pointee of |delegate| is assumed by the transport.
72 // Prior delegates are deleted automatically. 70 // Prior delegates are deleted automatically.
73 virtual void SetReadDelegate(std::unique_ptr<Delegate> delegate) = 0; 71 virtual void SetReadDelegate(std::unique_ptr<Delegate> delegate) = 0;
74 }; 72 };
75 73
76 // Manager class for reading and writing messages to/from a socket. 74 // Manager class for reading and writing messages to/from a socket.
77 class CastTransportImpl : public CastTransport, public base::NonThreadSafe { 75 class CastTransportImpl : public CastTransport {
78 public: 76 public:
79 using ChannelAuthType = ::cast_channel::ChannelAuthType; 77 using ChannelAuthType = ::cast_channel::ChannelAuthType;
80 using ChannelError = ::cast_channel::ChannelError; 78 using ChannelError = ::cast_channel::ChannelError;
81 79
82 // Adds a CastMessage read/write layer to a socket. 80 // Adds a CastMessage read/write layer to a socket.
83 // Message read events are propagated to the owner via |read_delegate|. 81 // Message read events are propagated to the owner via |read_delegate|.
84 // |vlog_prefix| sets the prefix used for all VLOGged output. 82 // |vlog_prefix| sets the prefix used for all VLOGged output.
85 // |socket| and |logger| must all out-live the 83 // |socket| and |logger| must all out-live the
86 // CastTransportImpl instance. 84 // CastTransportImpl instance.
87 // |read_delegate| is owned by this CastTransportImpl object. 85 // |read_delegate| is owned by this CastTransportImpl object.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 211
214 // IP address of the remote end. 212 // IP address of the remote end.
215 const net::IPEndPoint ip_endpoint_; 213 const net::IPEndPoint ip_endpoint_;
216 214
217 // Authentication level for the connection. 215 // Authentication level for the connection.
218 ChannelAuthType channel_auth_; 216 ChannelAuthType channel_auth_;
219 217
220 // Accumulates details of events and errors, for debugging purposes. 218 // Accumulates details of events and errors, for debugging purposes.
221 scoped_refptr<Logger> logger_; 219 scoped_refptr<Logger> logger_;
222 220
221 THREAD_CHECKER(thread_checker_);
222
223 DISALLOW_COPY_AND_ASSIGN(CastTransportImpl); 223 DISALLOW_COPY_AND_ASSIGN(CastTransportImpl);
224 }; 224 };
225 } // namespace cast_channel 225 } // namespace cast_channel
226 } // namespace api
227 } // namespace extensions
228 226
229 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TRANSPORT_H_ 227 #endif // COMPONENTS_CAST_CHANNEL_CAST_TRANSPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698