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

Side by Side Diff: ipc/ipc_channel_proxy.h

Issue 2608783003: Fix ThreadSafeAssociatedInterfacePtrProvider raciness. (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 IPC_IPC_CHANNEL_PROXY_H_ 5 #ifndef IPC_IPC_CHANNEL_PROXY_H_
6 #define IPC_IPC_CHANNEL_PROXY_H_ 6 #define IPC_IPC_CHANNEL_PROXY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // Creates an AssociatedInterfacePtr to |Interface| on the IO thread and 235 // Creates an AssociatedInterfacePtr to |Interface| on the IO thread and
236 // passes it to |callback|, also invoked on the IO thread. 236 // passes it to |callback|, also invoked on the IO thread.
237 template <typename Interface> 237 template <typename Interface>
238 void RetrieveAssociatedInterfaceOnIOThread( 238 void RetrieveAssociatedInterfaceOnIOThread(
239 const AssociatedInterfaceRetrievedCallback<Interface>& callback) { 239 const AssociatedInterfaceRetrievedCallback<Interface>& callback) {
240 context_->ipc_task_runner()->PostTask( 240 context_->ipc_task_runner()->PostTask(
241 FROM_HERE, base::Bind(&Context::RetrieveAssociatedInterface<Interface>, 241 FROM_HERE, base::Bind(&Context::RetrieveAssociatedInterface<Interface>,
242 context_, callback)); 242 context_, callback));
243 } 243 }
244 244
245 base::SingleThreadTaskRunner* ipc_task_runner() const {
246 return context_->ipc_task_runner();
247 }
248
245 // Called to clear the pointer to the IPC task runner when it's going away. 249 // Called to clear the pointer to the IPC task runner when it's going away.
246 void ClearIPCTaskRunner(); 250 void ClearIPCTaskRunner();
247 251
248 protected: 252 protected:
249 class Context; 253 class Context;
250 // A subclass uses this constructor if it needs to add more information 254 // A subclass uses this constructor if it needs to add more information
251 // to the internal state. 255 // to the internal state.
252 explicit ChannelProxy(Context* context); 256 explicit ChannelProxy(Context* context);
253 257
254 // Used internally to hold state that is referenced on the IPC thread. 258 // Used internally to hold state that is referenced on the IPC thread.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 bool did_init_; 426 bool did_init_;
423 427
424 #if defined(ENABLE_IPC_FUZZER) 428 #if defined(ENABLE_IPC_FUZZER)
425 OutgoingMessageFilter* outgoing_message_filter_; 429 OutgoingMessageFilter* outgoing_message_filter_;
426 #endif 430 #endif
427 }; 431 };
428 432
429 } // namespace IPC 433 } // namespace IPC
430 434
431 #endif // IPC_IPC_CHANNEL_PROXY_H_ 435 #endif // IPC_IPC_CHANNEL_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698