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

Side by Side Diff: ipc/ipc_channel_proxy.cc

Issue 2494373002: Remove IPC channel IDs. (Closed)
Patch Set: rebase Created 4 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
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_logging.h » ('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 (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 #include "ipc/ipc_channel_proxy.h" 5 #include "ipc/ipc_channel_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 void ChannelProxy::Context::ClearIPCTaskRunner() { 67 void ChannelProxy::Context::ClearIPCTaskRunner() {
68 ipc_task_runner_ = NULL; 68 ipc_task_runner_ = NULL;
69 } 69 }
70 70
71 void ChannelProxy::Context::CreateChannel( 71 void ChannelProxy::Context::CreateChannel(
72 std::unique_ptr<ChannelFactory> factory) { 72 std::unique_ptr<ChannelFactory> factory) {
73 base::AutoLock l(channel_lifetime_lock_); 73 base::AutoLock l(channel_lifetime_lock_);
74 DCHECK(!channel_); 74 DCHECK(!channel_);
75 DCHECK_EQ(factory->GetIPCTaskRunner(), ipc_task_runner_); 75 DCHECK_EQ(factory->GetIPCTaskRunner(), ipc_task_runner_);
76 channel_id_ = factory->GetName();
77 channel_ = factory->BuildChannel(this); 76 channel_ = factory->BuildChannel(this);
78 77
79 Channel::AssociatedInterfaceSupport* support = 78 Channel::AssociatedInterfaceSupport* support =
80 channel_->GetAssociatedInterfaceSupport(); 79 channel_->GetAssociatedInterfaceSupport();
81 if (support) { 80 if (support) {
82 associated_group_ = *support->GetAssociatedGroup(); 81 associated_group_ = *support->GetAssociatedGroup();
83 82
84 base::AutoLock l(pending_filters_lock_); 83 base::AutoLock l(pending_filters_lock_);
85 for (auto& entry : pending_interfaces_) 84 for (auto& entry : pending_interfaces_)
86 support->AddGenericAssociatedInterface(entry.first, entry.second); 85 support->AddGenericAssociatedInterface(entry.first, entry.second);
87 pending_interfaces_.clear(); 86 pending_interfaces_.clear();
88 } 87 }
89 } 88 }
90 89
91 bool ChannelProxy::Context::TryFilters(const Message& message) { 90 bool ChannelProxy::Context::TryFilters(const Message& message) {
92 DCHECK(message_filter_router_); 91 DCHECK(message_filter_router_);
93 #ifdef IPC_MESSAGE_LOG_ENABLED 92 #ifdef IPC_MESSAGE_LOG_ENABLED
94 Logging* logger = Logging::GetInstance(); 93 Logging* logger = Logging::GetInstance();
95 if (logger->Enabled()) 94 if (logger->Enabled())
96 logger->OnPreDispatchMessage(message); 95 logger->OnPreDispatchMessage(message);
97 #endif 96 #endif
98 97
99 if (message_filter_router_->TryFilters(message)) { 98 if (message_filter_router_->TryFilters(message)) {
100 if (message.dispatch_error()) { 99 if (message.dispatch_error()) {
101 listener_task_runner_->PostTask( 100 listener_task_runner_->PostTask(
102 FROM_HERE, base::Bind(&Context::OnDispatchBadMessage, this, message)); 101 FROM_HERE, base::Bind(&Context::OnDispatchBadMessage, this, message));
103 } 102 }
104 #ifdef IPC_MESSAGE_LOG_ENABLED 103 #ifdef IPC_MESSAGE_LOG_ENABLED
105 if (logger->Enabled()) 104 if (logger->Enabled())
106 logger->OnPostDispatchMessage(message, channel_id_); 105 logger->OnPostDispatchMessage(message);
107 #endif 106 #endif
108 return true; 107 return true;
109 } 108 }
110 return false; 109 return false;
111 } 110 }
112 111
113 // Called on the IPC::Channel thread 112 // Called on the IPC::Channel thread
114 void ChannelProxy::Context::PauseChannel() { 113 void ChannelProxy::Context::PauseChannel() {
115 DCHECK(channel_); 114 DCHECK(channel_);
116 channel_->Pause(); 115 channel_->Pause();
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (logger->Enabled()) 341 if (logger->Enabled())
343 logger->OnPreDispatchMessage(message); 342 logger->OnPreDispatchMessage(message);
344 #endif 343 #endif
345 344
346 listener_->OnMessageReceived(message); 345 listener_->OnMessageReceived(message);
347 if (message.dispatch_error()) 346 if (message.dispatch_error())
348 listener_->OnBadMessageReceived(message); 347 listener_->OnBadMessageReceived(message);
349 348
350 #ifdef IPC_MESSAGE_LOG_ENABLED 349 #ifdef IPC_MESSAGE_LOG_ENABLED
351 if (logger->Enabled()) 350 if (logger->Enabled())
352 logger->OnPostDispatchMessage(message, channel_id_); 351 logger->OnPostDispatchMessage(message);
353 #endif 352 #endif
354 } 353 }
355 354
356 // Called on the listener's thread 355 // Called on the listener's thread
357 void ChannelProxy::Context::OnDispatchConnected() { 356 void ChannelProxy::Context::OnDispatchConnected() {
358 if (channel_connected_called_) 357 if (channel_connected_called_)
359 return; 358 return;
360 359
361 base::ProcessId peer_pid; 360 base::ProcessId peer_pid;
362 { 361 {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 562
564 #ifdef ENABLE_IPC_FUZZER 563 #ifdef ENABLE_IPC_FUZZER
565 // In IPC fuzzing builds, it is possible to define a filter to apply to 564 // In IPC fuzzing builds, it is possible to define a filter to apply to
566 // outgoing messages. It will either rewrite the message and return a new 565 // outgoing messages. It will either rewrite the message and return a new
567 // one, freeing the original, or return the message unchanged. 566 // one, freeing the original, or return the message unchanged.
568 if (outgoing_message_filter()) 567 if (outgoing_message_filter())
569 message = outgoing_message_filter()->Rewrite(message); 568 message = outgoing_message_filter()->Rewrite(message);
570 #endif 569 #endif
571 570
572 #ifdef IPC_MESSAGE_LOG_ENABLED 571 #ifdef IPC_MESSAGE_LOG_ENABLED
573 Logging::GetInstance()->OnSendMessage(message, context_->channel_id()); 572 Logging::GetInstance()->OnSendMessage(message);
574 #endif 573 #endif
575 574
576 context_->Send(message); 575 context_->Send(message);
577 return true; 576 return true;
578 } 577 }
579 578
580 void ChannelProxy::AddFilter(MessageFilter* filter) { 579 void ChannelProxy::AddFilter(MessageFilter* filter) {
581 DCHECK(CalledOnValidThread()); 580 DCHECK(CalledOnValidThread());
582 581
583 context_->AddFilter(filter); 582 context_->AddFilter(filter);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 620
622 context()->ClearIPCTaskRunner(); 621 context()->ClearIPCTaskRunner();
623 } 622 }
624 623
625 void ChannelProxy::OnChannelInit() { 624 void ChannelProxy::OnChannelInit() {
626 } 625 }
627 626
628 //----------------------------------------------------------------------------- 627 //-----------------------------------------------------------------------------
629 628
630 } // namespace IPC 629 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698