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

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

Issue 1524333002: Fix race condition with multiplexed message pipes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | mojo/edk/system/broker_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 MOJO_EDK_SYSTEM_BROKER_STATE_H_ 5 #ifndef MOJO_EDK_SYSTEM_BROKER_STATE_H_
6 #define MOJO_EDK_SYSTEM_BROKER_STATE_H_ 6 #define MOJO_EDK_SYSTEM_BROKER_STATE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ~BrokerState() override; 60 ~BrokerState() override;
61 61
62 // Checks if there's a direct channel between the two processes, and if not 62 // Checks if there's a direct channel between the two processes, and if not
63 // creates one and tells them about it. 63 // creates one and tells them about it.
64 void EnsureProcessesConnected(base::ProcessId pid1, base::ProcessId pid2); 64 void EnsureProcessesConnected(base::ProcessId pid1, base::ProcessId pid2);
65 65
66 // Callback when a RoutedRawChannel is destroyed for cleanup. 66 // Callback when a RoutedRawChannel is destroyed for cleanup.
67 // Called on the IO thread. 67 // Called on the IO thread.
68 void ChannelDestructed(RoutedRawChannel* channel); 68 void ChannelDestructed(RoutedRawChannel* channel);
69 69
70 // Helper method to connect the given MessagePipe to the channel.
71 void AttachMessagePipe(MessagePipeDispatcher* message_pipe,
72 uint64_t pipe_id,
73 RoutedRawChannel* raw_channel);
74
70 #if defined(OS_WIN) 75 #if defined(OS_WIN)
71 // Used in the parent (unsandboxed) process to hold a mapping between HANDLES 76 // Used in the parent (unsandboxed) process to hold a mapping between HANDLES
72 // and tokens. When a child process wants to send a HANDLE to another process, 77 // and tokens. When a child process wants to send a HANDLE to another process,
73 // it exchanges it to a token and then the other process exchanges that token 78 // it exchanges it to a token and then the other process exchanges that token
74 // back to a HANDLE. 79 // back to a HANDLE.
75 base::Lock token_map_lock_; 80 base::Lock token_map_lock_;
76 base::hash_map<uint64_t, HANDLE> token_map_; 81 base::hash_map<uint64_t, HANDLE> token_map_;
77 #endif 82 #endif
78 83
79 // For pending connects originiating in this process. 84 // For pending connects originiating in this process.
(...skipping 24 matching lines...) Expand all
104 RoutedRawChannel* in_process_pipes_channel1_; 109 RoutedRawChannel* in_process_pipes_channel1_;
105 RoutedRawChannel* in_process_pipes_channel2_; 110 RoutedRawChannel* in_process_pipes_channel2_;
106 111
107 DISALLOW_COPY_AND_ASSIGN(BrokerState); 112 DISALLOW_COPY_AND_ASSIGN(BrokerState);
108 }; 113 };
109 114
110 } // namespace edk 115 } // namespace edk
111 } // namespace mojo 116 } // namespace mojo
112 117
113 #endif // MOJO_EDK_SYSTEM_BROKER_STATE_H_ 118 #endif // MOJO_EDK_SYSTEM_BROKER_STATE_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/broker_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698