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

Side by Side Diff: ppapi/proxy/udp_socket_filter.cc

Issue 2886913005: Rename TaskRunner::RunsTasksOnCurrentThread() in //dbus, //chromeos, //ppapi (Closed)
Patch Set: Created 3 years, 7 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.cc ('k') | no next file » | 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 #include "ppapi/proxy/udp_socket_filter.h" 5 #include "ppapi/proxy/udp_socket_filter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 base::AutoLock acquire(lock_); 110 base::AutoLock acquire(lock_);
111 auto it = queues_.find(resource); 111 auto it = queues_.find(resource);
112 return it->second->GetLastAddrPrivate(); 112 return it->second->GetLastAddrPrivate();
113 } 113 }
114 114
115 void UDPSocketFilter::OnPluginMsgPushRecvResult( 115 void UDPSocketFilter::OnPluginMsgPushRecvResult(
116 const ResourceMessageReplyParams& params, 116 const ResourceMessageReplyParams& params,
117 int32_t result, 117 int32_t result,
118 const std::string& data, 118 const std::string& data,
119 const PP_NetAddress_Private& addr) { 119 const PP_NetAddress_Private& addr) {
120 DCHECK(PluginGlobals::Get()->ipc_task_runner()->RunsTasksOnCurrentThread()); 120 DCHECK(PluginGlobals::Get()->ipc_task_runner()->RunsTasksInCurrentSequence());
121 base::AutoLock acquire(lock_); 121 base::AutoLock acquire(lock_);
122 auto it = queues_.find(params.pp_resource()); 122 auto it = queues_.find(params.pp_resource());
123 // The RecvQueue might be gone if there were messages in-flight for a 123 // The RecvQueue might be gone if there were messages in-flight for a
124 // resource that has been destroyed. 124 // resource that has been destroyed.
125 if (it != queues_.end()) { 125 if (it != queues_.end()) {
126 // TODO(yzshen): Support passing in a non-const string ref, so that we can 126 // TODO(yzshen): Support passing in a non-const string ref, so that we can
127 // eliminate one copy when storing the data in the buffer. 127 // eliminate one copy when storing the data in the buffer.
128 it->second->DataReceivedOnIOThread(result, data, addr); 128 it->second->DataReceivedOnIOThread(result, data, addr);
129 } 129 }
130 } 130 }
(...skipping 13 matching lines...) Expand all
144 144
145 UDPSocketFilter::RecvQueue::~RecvQueue() { 145 UDPSocketFilter::RecvQueue::~RecvQueue() {
146 if (TrackedCallback::IsPending(recvfrom_callback_)) 146 if (TrackedCallback::IsPending(recvfrom_callback_))
147 recvfrom_callback_->PostAbort(); 147 recvfrom_callback_->PostAbort();
148 } 148 }
149 149
150 void UDPSocketFilter::RecvQueue::DataReceivedOnIOThread( 150 void UDPSocketFilter::RecvQueue::DataReceivedOnIOThread(
151 int32_t result, 151 int32_t result,
152 const std::string& data, 152 const std::string& data,
153 const PP_NetAddress_Private& addr) { 153 const PP_NetAddress_Private& addr) {
154 DCHECK(PluginGlobals::Get()->ipc_task_runner()->RunsTasksOnCurrentThread()); 154 DCHECK(PluginGlobals::Get()->ipc_task_runner()->RunsTasksInCurrentSequence());
155 DCHECK_LT(recv_buffers_.size(), 155 DCHECK_LT(recv_buffers_.size(),
156 static_cast<size_t>( 156 static_cast<size_t>(
157 UDPSocketResourceConstants::kPluginReceiveBufferSlots)); 157 UDPSocketResourceConstants::kPluginReceiveBufferSlots));
158 158
159 if (!TrackedCallback::IsPending(recvfrom_callback_) || !read_buffer_) { 159 if (!TrackedCallback::IsPending(recvfrom_callback_) || !read_buffer_) {
160 recv_buffers_.push(RecvBuffer()); 160 recv_buffers_.push(RecvBuffer());
161 RecvBuffer& back = recv_buffers_.back(); 161 RecvBuffer& back = recv_buffers_.back();
162 back.result = result; 162 back.result = result;
163 back.data = data; 163 back.data = data;
164 back.addr = addr; 164 back.addr = addr;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 } 240 }
241 241
242 PP_NetAddress_Private UDPSocketFilter::RecvQueue::GetLastAddrPrivate() const { 242 PP_NetAddress_Private UDPSocketFilter::RecvQueue::GetLastAddrPrivate() const {
243 CHECK(private_api_); 243 CHECK(private_api_);
244 return last_recvfrom_addr_; 244 return last_recvfrom_addr_;
245 } 245 }
246 246
247 } // namespace proxy 247 } // namespace proxy
248 } // namespace ppapi 248 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/host/resource_message_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698