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

Side by Side Diff: ipc/ipc_test_sink.cc

Issue 10698057: Remove Message::Sender and Channel::Listener typedefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_test_sink.h ('k') | ipc/ipc_tests.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_test_sink.h" 5 #include "ipc/ipc_test_sink.h"
6 6
7 #include "ipc/ipc_message.h" 7 #include "ipc/ipc_message.h"
8 8
9 namespace IPC { 9 namespace IPC {
10 10
11 TestSink::TestSink() { 11 TestSink::TestSink() {
12 } 12 }
13 13
14 TestSink::~TestSink() { 14 TestSink::~TestSink() {
15 } 15 }
16 16
17 bool TestSink::Send(Message* message) { 17 bool TestSink::Send(Message* message) {
18 OnMessageReceived(*message); 18 OnMessageReceived(*message);
19 delete message; 19 delete message;
20 return true; 20 return true;
21 } 21 }
22 22
23 bool TestSink::OnMessageReceived(const Message& msg) { 23 bool TestSink::OnMessageReceived(const Message& msg) {
24 ObserverListBase<Channel::Listener>::Iterator it(filter_list_); 24 ObserverListBase<Listener>::Iterator it(filter_list_);
25 Channel::Listener* observer; 25 Listener* observer;
26 while ((observer = it.GetNext()) != NULL) { 26 while ((observer = it.GetNext()) != NULL) {
27 if (observer->OnMessageReceived(msg)) 27 if (observer->OnMessageReceived(msg))
28 return true; 28 return true;
29 } 29 }
30 30
31 // No filter handled the message, so store it. 31 // No filter handled the message, so store it.
32 messages_.push_back(Message(msg)); 32 messages_.push_back(Message(msg));
33 return true; 33 return true;
34 } 34 }
35 35
(...skipping 22 matching lines...) Expand all
58 if (messages_[i].type() == id) { 58 if (messages_[i].type() == id) {
59 found_count++; 59 found_count++;
60 found_index = i; 60 found_index = i;
61 } 61 }
62 } 62 }
63 if (found_count != 1) 63 if (found_count != 1)
64 return NULL; // Didn't find a unique one. 64 return NULL; // Didn't find a unique one.
65 return &messages_[found_index]; 65 return &messages_[found_index];
66 } 66 }
67 67
68 void TestSink::AddFilter(Channel::Listener* filter) { 68 void TestSink::AddFilter(Listener* filter) {
69 filter_list_.AddObserver(filter); 69 filter_list_.AddObserver(filter);
70 } 70 }
71 71
72 void TestSink::RemoveFilter(Channel::Listener* filter) { 72 void TestSink::RemoveFilter(Listener* filter) {
73 filter_list_.RemoveObserver(filter); 73 filter_list_.RemoveObserver(filter);
74 } 74 }
75 75
76 } // namespace IPC 76 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_test_sink.h ('k') | ipc/ipc_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698