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

Side by Side Diff: mojo/edk/system/routed_raw_channel.h

Issue 1649633002: Remove files that are no longer used in the Port EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « mojo/edk/system/raw_channel_win.cc ('k') | mojo/edk/system/routed_raw_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef MOJO_EDK_SYSTEM_ROUTED_RAW_CHANNEL_H_
6 #define MOJO_EDK_SYSTEM_ROUTED_RAW_CHANNEL_H_
7
8 #include <stdint.h>
9
10 #include "base/callback.h"
11 #include "base/containers/hash_tables.h"
12 #include "base/macros.h"
13 #include "mojo/edk/embedder/platform_handle_vector.h"
14 #include "mojo/edk/embedder/scoped_platform_handle.h"
15 #include "mojo/edk/system/broker.h"
16 #include "mojo/edk/system/raw_channel.h"
17 #include "mojo/edk/system/system_impl_export.h"
18
19 namespace mojo {
20 namespace edk {
21 class RawChannel;
22
23 // This class wraps a RawChannel and adds routing on top of it.
24 // Any RawChannel::Delegate can call here, indirectly through the Broker
25 // interface, to get notified about messages with its route_id.
26 class RoutedRawChannel : public RawChannel::Delegate {
27 public:
28 RoutedRawChannel(
29 ScopedPlatformHandle handle,
30 const base::Callback<void(RoutedRawChannel*)>& destruct_callback);
31
32 // These methods should all be called on the IO thread only.
33
34 // Connect the given |delegate| with the |route_id|.
35 void AddRoute(uint64_t route_id, RawChannel::Delegate* delegate);
36
37 // Called when the route listener is going away.
38 void RemoveRoute(uint64_t route_id);
39
40 RawChannel* channel() { return channel_; }
41
42 private:
43 friend class base::DeleteHelper<RoutedRawChannel>;
44 ~RoutedRawChannel() override;
45
46 // RawChannel::Delegate implementation:
47 void OnReadMessage(
48 const MessageInTransit::View& message_view,
49 ScopedPlatformHandleVectorPtr platform_handles) override;
50 void OnError(Error error) override;
51
52 RawChannel* channel_;
53
54 base::hash_map<uint64_t, RawChannel::Delegate*> routes_;
55
56 // If we got messages before the route was added (due to race conditions
57 // between different channels), this is used to buffer them.
58 struct PendingMessage {
59 PendingMessage();
60 ~PendingMessage();
61 std::vector<char> message;
62 ScopedPlatformHandleVectorPtr handles;
63 };
64 std::vector<scoped_ptr<PendingMessage>> pending_messages_;
65
66 // If we got a ROUTE_CLOSED message for a route before it registered with us,
67 // we need to hold on to this information so that we can tell it that the
68 // connetion is closed when it does connect.
69 base::hash_set<uint64_t> close_routes_;
70
71 base::Callback<void(RoutedRawChannel*)> destruct_callback_;
72
73 DISALLOW_COPY_AND_ASSIGN(RoutedRawChannel);
74 };
75
76 } // namespace edk
77 } // namespace mojo
78
79 #endif // MOJO_EDK_SYSTEM_ROUTED_RAW_CHANNEL_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/raw_channel_win.cc ('k') | mojo/edk/system/routed_raw_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698