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

Side by Side Diff: chrome/renderer/media/cast_session.h

Issue 66293003: P2P <-> cast library integration v0.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 5 #ifndef CHROME_RENDERER_MEDIA_CAST_SESSION_H_
6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/ip_endpoint.h"
11 12
12 namespace base { 13 namespace base {
13 class MessageLoopProxy; 14 class MessageLoopProxy;
14 } // namespace base 15 } // namespace base
15 16
17 namespace content{
18 class P2PSocketClient;
19 };
20
16 class CastSessionDelegate; 21 class CastSessionDelegate;
17 22
18 // This class represents a Cast session and allows the session to be 23 // This class represents a Cast session and allows the session to be
19 // configured on the main thread. Actual work is forwarded to 24 // configured on the main thread. Actual work is forwarded to
20 // CastSessionDelegate on the IO thread. 25 // CastSessionDelegate on the IO thread.
21 class CastSession : public base::RefCounted<CastSession> { 26 class CastSession : public base::RefCounted<CastSession> {
22 public: 27 public:
23 CastSession(); 28 CastSession();
24 29
30 class SocketFactory {
31 public:
32 virtual ~SocketFactory();
33
34 // Called on IO thread.
35 virtual content::P2PSocketClient* create() = 0;
Alpha Left Google 2013/11/09 00:30:18 Return type should be scoped_ptr<T>.
hubbe 2013/11/26 20:24:29 scoped_refptr<>
36 };
37
38 // Send the socket factory to the delegate, where create will be
39 // called. The delegate will then delete the socket factory on the
40 // IO thread. We do it this way because the P2P socket needs to
41 // be created on the same thread that the callbacks will be called on.
42 // The |remote_endpoint| is the address will be used when calling
43 // SendWithDscp on the P2PSocketClient.
44 // Takes ownership of socket_factory.
45 void SetSocketFactory(SocketFactory* socket_factory,
Alpha Left Google 2013/11/09 00:30:18 Use scoped_ptr<> for type of socket_factory. This
hubbe 2013/11/26 20:24:29 Done.
46 const net::IPEndPoint& remote_address);
47
25 private: 48 private:
26 friend class base::RefCounted<CastSession>; 49 friend class base::RefCounted<CastSession>;
27 virtual ~CastSession(); 50 virtual ~CastSession();
28 51
29 // This member should never be dereferenced on the main thread. 52 // This member should never be dereferenced on the main thread.
30 // CastSessionDelegate lives only on the IO thread. It is always 53 // CastSessionDelegate lives only on the IO thread. It is always
31 // safe to post task on the IO thread to access CastSessionDelegate 54 // safe to post task on the IO thread to access CastSessionDelegate
32 // because it is owned by this object. 55 // because it is owned by this object.
33 scoped_ptr<CastSessionDelegate> delegate_; 56 scoped_ptr<CastSessionDelegate> delegate_;
34 57
35 // Proxy to the IO message loop. 58 // Proxy to the IO message loop.
36 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 59 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
37 60
38 DISALLOW_COPY_AND_ASSIGN(CastSession); 61 DISALLOW_COPY_AND_ASSIGN(CastSession);
39 }; 62 };
40 63
41 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 64 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/media/cast_session.cc » ('j') | chrome/renderer/media/cast_session_delegate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698