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

Side by Side Diff: components/devtools_bridge/abstract_data_channel.h

Issue 1142463003: Remove devtools_bridge component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_DEVTOOLS_BRIDGE_ABSTRACT_DATA_CHANNEL_H_
6 #define COMPONENTS_DEVTOOLS_BRIDGE_ABSTRACT_DATA_CHANNEL_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13
14 namespace devtools_bridge {
15
16 /**
17 * WebRTC DataChannel adapter for DevTools bridge. Not thread safe.
18 */
19 class AbstractDataChannel {
20 public:
21 AbstractDataChannel() {}
22 virtual ~AbstractDataChannel() {}
23
24 /**
25 * Called on WebRTC signaling thread.
26 */
27 class Observer {
28 public:
29 Observer() {}
30 virtual ~Observer() {}
31
32 virtual void OnOpen() = 0;
33 virtual void OnClose() = 0;
34
35 virtual void OnMessage(const void* data, size_t length) = 0;
36
37 private:
38 DISALLOW_COPY_AND_ASSIGN(Observer);
39 };
40
41 /**
42 * Proxy for accessing data channel from a different thread.
43 * May outlive data channel (methods will have no effect if DataChannel
44 * destroyed).
45 */
46 class Proxy : public base::RefCountedThreadSafe<Proxy> {
47 public:
48 virtual void SendBinaryMessage(const void* data, size_t length) = 0;
49 virtual void Close() = 0;
50
51 protected:
52 Proxy() {}
53 virtual ~Proxy() {}
54
55 private:
56 friend class base::RefCountedThreadSafe<Proxy>;
57
58 DISALLOW_COPY_AND_ASSIGN(Proxy);
59 };
60
61 virtual void RegisterObserver(scoped_ptr<Observer> observer) = 0;
62 virtual void UnregisterObserver() = 0;
63
64 virtual void SendBinaryMessage(void* data, size_t length) = 0;
65 virtual void SendTextMessage(void* data, size_t length) = 0;
66
67 virtual void Close() = 0;
68
69 virtual scoped_refptr<Proxy> proxy() = 0;
70
71 private:
72 DISALLOW_COPY_AND_ASSIGN(AbstractDataChannel);
73 };
74
75 } // namespace devtools_bridge
76
77 #endif // COMPONENTS_DEVTOOLS_BRIDGE_ABSTRACT_DATA_CHANNEL_H_
OLDNEW
« no previous file with comments | « components/devtools_bridge/README ('k') | components/devtools_bridge/abstract_peer_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698