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

Side by Side Diff: chromeos/arc/bridge/common/arc_bridge.h

Issue 1424503002: arc-bridge: Add IPC message definitions (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Renamed libarcbridge=>bridge/common and addressed feedback Created 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // A communication channel between Chrome and an ARC instance.
6 // This component will send and receive messages across a socket that is
7 // available to the ARC instance when it is started.
8
9 #ifndef CHROMEOS_ARC_LIBARCBRIDGE_ARC_ARC_BRIDGE_H_
10 #define CHROMEOS_ARC_LIBARCBRIDGE_ARC_ARC_BRIDGE_H_
11
12 #include "base/macros.h"
13 #include "ipc/ipc_channel_proxy.h"
14 #include "ipc/ipc_listener.h"
15 #include "ipc/ipc_message.h"
16
17 namespace arc {
18
19 // Abstract class that represents one of the ARC bridge endpoints.
20 class BridgeEndpoint : public IPC::Listener {
hidehiko 2015/10/26 09:15:00 What's the usage of BridgeEndpoint? If this is ju
Shuhei Takahashi 2015/10/26 11:13:40 +1 If you still want to use a base class, please
Luis Héctor Chávez 2015/10/26 21:03:27 Having it as a base class avoids repeating the Con
21 public:
22 BridgeEndpoint();
23 virtual ~BridgeEndpoint();
24
25 // Connects the endpoint of the bridge through the specified channel handle.
26 // This function is mainly for testing, since callers can call the
Shuhei Takahashi 2015/10/26 11:13:40 Do you mean "This function is mainly *exposed* for
Luis Héctor Chávez 2015/10/26 21:03:27 Done
27 // subclasses' Socketconnect().
28 bool Connect(const IPC::ChannelHandle& handle, IPC::Channel::Mode mode);
29
30 protected:
31 scoped_ptr<IPC::ChannelProxy> channel_;
32
33 base::Thread ipc_thread_;
34
35 private:
36 DISALLOW_COPY_AND_ASSIGN(BridgeEndpoint);
37 };
38
39 // Instance side of the ARC bridge.
satorux1 2015/10/26 01:58:52 I felt that relationship with 'instance side' and
Luis Héctor Chávez 2015/10/26 21:03:27 Done.
40 class BridgeInstanceEndpoint : public BridgeEndpoint {
41 public:
42 BridgeInstanceEndpoint();
43 virtual ~BridgeInstanceEndpoint();
44
45 bool SocketConnect(const std::string& socket_path);
46
47 // Messages from the instance to the host.
48 bool InstanceReady();
49
50 private:
51 bool OnMessageReceived(const IPC::Message& message) override;
satorux1 2015/10/26 01:58:52 please add function comments to these functions. i
Luis Héctor Chávez 2015/10/26 21:03:27 Done.
52 void OnPing();
satorux1 2015/10/26 01:58:52 What's ping? Is this a sample function or does it
Luis Héctor Chávez 2015/10/26 21:03:27 It was added at some point to avoid a compilation
53 virtual void OnRegisterInputDevice(const std::string& name,
satorux1 2015/10/26 01:58:52 In particular, please document how sub classes are
Luis Héctor Chávez 2015/10/26 21:03:27 Done.
54 const std::string& device_type,
55 base::FileDescriptor fd) = 0;
56
57 DISALLOW_COPY_AND_ASSIGN(BridgeInstanceEndpoint);
58 };
59
60 // Host side of the ARC bridge.
61 class BridgeHostEndpoint : public BridgeEndpoint {
Shuhei Takahashi 2015/10/26 11:13:40 nit: To follow IPC naming convention, maybe want t
Luis Héctor Chávez 2015/10/26 21:03:27 Oh I was not aware of this convention. Renamed to
62 public:
63 BridgeHostEndpoint();
64 virtual ~BridgeHostEndpoint();
65
66 bool SocketConnect(const std::string& socket_path);
satorux1 2015/10/26 01:58:52 ditto. function comment is missing.
Luis Héctor Chávez 2015/10/26 21:03:27 Done.
67
68 // Messages from the host to the instance.
69 bool Ping();
70 bool RegisterInputDevice(const std::string& name,
71 const std::string& device_type,
72 base::ScopedFD fd);
73
74 private:
75 bool OnMessageReceived(const IPC::Message& message) override;
76 virtual void OnInstanceReady() = 0;
77 virtual void OnPong() = 0;
78
79 DISALLOW_COPY_AND_ASSIGN(BridgeHostEndpoint);
80 };
81
82 } // namespace arc
83
84 #endif // CHROMEOS_ARC_LIBARCBRIDGE_ARC_ARC_BRIDGE_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/arc/bridge/common/arc_bridge.cc » ('j') | chromeos/arc/bridge/common/arc_bridge.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698