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

Side by Side Diff: ppapi/host/resource_message_filter_unittest.cc

Issue 1097393007: Update {virtual,override} to follow C++11 style in ppapi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split off one file into separate review. Created 5 years, 8 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 | « ppapi/host/resource_message_filter.h ('k') | ppapi/nacl_irt/manifest_service.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) 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const IPC::Message& last_handled_msg() const { return last_handled_msg_; } 52 const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
53 const IPC::Message& last_reply_msg() const { return last_reply_msg_; } 53 const IPC::Message& last_reply_msg() const { return last_reply_msg_; }
54 base::MessageLoop* last_reply_message_loop() const { 54 base::MessageLoop* last_reply_message_loop() const {
55 return last_reply_message_loop_; 55 return last_reply_message_loop_;
56 } 56 }
57 57
58 void AddMessageFilter(scoped_refptr<ResourceMessageFilter> filter) { 58 void AddMessageFilter(scoped_refptr<ResourceMessageFilter> filter) {
59 AddFilter(filter); 59 AddFilter(filter);
60 } 60 }
61 61
62 virtual int32_t OnResourceMessageReceived( 62 int32_t OnResourceMessageReceived(const IPC::Message& msg,
63 const IPC::Message& msg, 63 HostMessageContext* context) override {
64 HostMessageContext* context) override {
65 last_handled_msg_ = msg; 64 last_handled_msg_ = msg;
66 if (msg.type() == msg_type_) { 65 if (msg.type() == msg_type_) {
67 context->reply_msg = IPC::Message(0, reply_msg_type_, 66 context->reply_msg = IPC::Message(0, reply_msg_type_,
68 IPC::Message::PRIORITY_NORMAL); 67 IPC::Message::PRIORITY_NORMAL);
69 return PP_OK; 68 return PP_OK;
70 } 69 }
71 return PP_ERROR_FAILED; 70 return PP_ERROR_FAILED;
72 } 71 }
73 72
74 virtual void SendReply(const ReplyMessageContext& context, 73 void SendReply(const ReplyMessageContext& context,
75 const IPC::Message& msg) override { 74 const IPC::Message& msg) override {
76 last_reply_msg_ = msg; 75 last_reply_msg_ = msg;
77 last_reply_message_loop_ = base::MessageLoop::current(); 76 last_reply_message_loop_ = base::MessageLoop::current();
78 g_handler_completion.Signal(); 77 g_handler_completion.Signal();
79 } 78 }
80 79
81 private: 80 private:
82 uint32 msg_type_; 81 uint32 msg_type_;
83 uint32 reply_msg_type_; 82 uint32 reply_msg_type_;
84 83
85 IPC::Message last_handled_msg_; 84 IPC::Message last_handled_msg_;
(...skipping 17 matching lines...) Expand all
103 : ResourceMessageFilter(io_thread.message_loop_proxy()), 102 : ResourceMessageFilter(io_thread.message_loop_proxy()),
104 message_loop_proxy_(bg_thread.message_loop_proxy()), 103 message_loop_proxy_(bg_thread.message_loop_proxy()),
105 msg_type_(msg_type), 104 msg_type_(msg_type),
106 reply_msg_type_(reply_msg_type), 105 reply_msg_type_(reply_msg_type),
107 last_message_loop_(NULL) { 106 last_message_loop_(NULL) {
108 } 107 }
109 108
110 const IPC::Message& last_handled_msg() const { return last_handled_msg_; } 109 const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
111 base::MessageLoop* last_message_loop() const { return last_message_loop_; } 110 base::MessageLoop* last_message_loop() const { return last_message_loop_; }
112 111
113 virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( 112 scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
114 const IPC::Message& msg) override { 113 const IPC::Message& msg) override {
115 if (msg.type() == msg_type_) 114 if (msg.type() == msg_type_)
116 return message_loop_proxy_; 115 return message_loop_proxy_;
117 return NULL; 116 return NULL;
118 } 117 }
119 118
120 virtual int32_t OnResourceMessageReceived( 119 int32_t OnResourceMessageReceived(
121 const IPC::Message& msg, 120 const IPC::Message& msg,
122 HostMessageContext* context) override { 121 HostMessageContext* context) override {
123 last_handled_msg_ = msg; 122 last_handled_msg_ = msg;
124 last_message_loop_ = base::MessageLoop::current(); 123 last_message_loop_ = base::MessageLoop::current();
125 if (msg.type() == msg_type_) { 124 if (msg.type() == msg_type_) {
126 context->reply_msg = IPC::Message(0, reply_msg_type_, 125 context->reply_msg = IPC::Message(0, reply_msg_type_,
127 IPC::Message::PRIORITY_NORMAL); 126 IPC::Message::PRIORITY_NORMAL);
128 return PP_OK; 127 return PP_OK;
129 } 128 }
130 return PP_ERROR_FAILED; 129 return PP_ERROR_FAILED;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 main_message_loop.PostTask( 214 main_message_loop.PostTask(
216 FROM_HERE, 215 FROM_HERE,
217 base::Bind(&ResourceMessageFilterTest::TestHandleMessageImpl, 216 base::Bind(&ResourceMessageFilterTest::TestHandleMessageImpl,
218 base::Unretained(this))); 217 base::Unretained(this)));
219 218
220 base::RunLoop().RunUntilIdle(); 219 base::RunLoop().RunUntilIdle();
221 } 220 }
222 221
223 } // namespace proxy 222 } // namespace proxy
224 } // namespace ppapi 223 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/host/resource_message_filter.h ('k') | ppapi/nacl_irt/manifest_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698