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

Side by Side Diff: ipc/ipc_channel_proxy.cc

Issue 11823027: [Android WebView] Implement the capture picture API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changes in native/Java AwContents to support SW rendering without platform functions (tests). Created 7 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 | Annotate | Revision Log
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/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ipc_task_runner_ = NULL; 61 ipc_task_runner_ = NULL;
62 } 62 }
63 63
64 void ChannelProxy::Context::CreateChannel(const IPC::ChannelHandle& handle, 64 void ChannelProxy::Context::CreateChannel(const IPC::ChannelHandle& handle,
65 const Channel::Mode& mode) { 65 const Channel::Mode& mode) {
66 DCHECK(channel_.get() == NULL); 66 DCHECK(channel_.get() == NULL);
67 channel_id_ = handle.name; 67 channel_id_ = handle.name;
68 channel_.reset(new Channel(handle, mode, this)); 68 channel_.reset(new Channel(handle, mode, this));
69 } 69 }
70 70
71 void ChannelProxy::Context::SendFailedSyncMessageReply(const Message& message) {
72 if (!message.is_sync())
73 return;
74
75 Message* reply = SyncMessage::GenerateReply(&message);
76 reply->set_reply_error();
77 ipc_task_runner()->PostTask(
78 FROM_HERE,
79 base::Bind(&ChannelProxy::Context::OnSendMessage,
80 this, base::Passed(scoped_ptr<Message>(reply))));
81 }
82
71 bool ChannelProxy::Context::TryFilters(const Message& message) { 83 bool ChannelProxy::Context::TryFilters(const Message& message) {
72 #ifdef IPC_MESSAGE_LOG_ENABLED 84 #ifdef IPC_MESSAGE_LOG_ENABLED
73 Logging* logger = Logging::GetInstance(); 85 Logging* logger = Logging::GetInstance();
74 if (logger->Enabled()) 86 if (logger->Enabled())
75 logger->OnPreDispatchMessage(message); 87 logger->OnPreDispatchMessage(message);
76 #endif 88 #endif
77 89
78 for (size_t i = 0; i < filters_.size(); ++i) { 90 for (size_t i = 0; i < filters_.size(); ++i) {
79 if (filters_[i]->OnMessageReceived(message)) { 91 if (filters_[i]->OnMessageReceived(message)) {
80 #ifdef IPC_MESSAGE_LOG_ENABLED 92 #ifdef IPC_MESSAGE_LOG_ENABLED
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 std::string name; 248 std::string name;
237 logger->GetMessageText(message.type(), &name, &message, NULL); 249 logger->GetMessageText(message.type(), &name, &message, NULL);
238 TRACE_EVENT1("task", "ChannelProxy::Context::OnDispatchMessage", 250 TRACE_EVENT1("task", "ChannelProxy::Context::OnDispatchMessage",
239 "name", name); 251 "name", name);
240 #else 252 #else
241 TRACE_EVENT2("task", "ChannelProxy::Context::OnDispatchMessage", 253 TRACE_EVENT2("task", "ChannelProxy::Context::OnDispatchMessage",
242 "class", IPC_MESSAGE_ID_CLASS(message.type()), 254 "class", IPC_MESSAGE_ID_CLASS(message.type()),
243 "line", IPC_MESSAGE_ID_LINE(message.type())); 255 "line", IPC_MESSAGE_ID_LINE(message.type()));
244 #endif 256 #endif
245 257
246 if (!listener_) 258 if (!listener_) {
259 SendFailedSyncMessageReply(message);
247 return; 260 return;
261 }
248 262
249 OnDispatchConnected(); 263 OnDispatchConnected();
250 264
251 #ifdef IPC_MESSAGE_LOG_ENABLED 265 #ifdef IPC_MESSAGE_LOG_ENABLED
252 if (message.type() == IPC_LOGGING_ID) { 266 if (message.type() == IPC_LOGGING_ID) {
253 logger->OnReceivedLoggingMessage(message); 267 logger->OnReceivedLoggingMessage(message);
268 SendFailedSyncMessageReply(message);
254 return; 269 return;
255 } 270 }
256 271
257 if (logger->Enabled()) 272 if (logger->Enabled())
258 logger->OnPreDispatchMessage(message); 273 logger->OnPreDispatchMessage(message);
259 #endif 274 #endif
260 275
261 listener_->OnMessageReceived(message); 276 if (!listener_->OnMessageReceived(message))
277 SendFailedSyncMessageReply(message);
262 278
263 #ifdef IPC_MESSAGE_LOG_ENABLED 279 #ifdef IPC_MESSAGE_LOG_ENABLED
264 if (logger->Enabled()) 280 if (logger->Enabled())
265 logger->OnPostDispatchMessage(message, channel_id_); 281 logger->OnPostDispatchMessage(message, channel_id_);
266 #endif 282 #endif
267 } 283 }
268 284
269 // Called on the listener's thread 285 // Called on the listener's thread
270 void ChannelProxy::Context::OnDispatchConnected() { 286 void ChannelProxy::Context::OnDispatchConnected() {
271 if (channel_connected_called_) 287 if (channel_connected_called_)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 Channel* channel = context_.get()->channel_.get(); 436 Channel* channel = context_.get()->channel_.get();
421 // Channel must have been created first. 437 // Channel must have been created first.
422 DCHECK(channel) << context_.get()->channel_id_; 438 DCHECK(channel) << context_.get()->channel_id_;
423 return channel->GetClientEuid(client_euid); 439 return channel->GetClientEuid(client_euid);
424 } 440 }
425 #endif 441 #endif
426 442
427 //----------------------------------------------------------------------------- 443 //-----------------------------------------------------------------------------
428 444
429 } // namespace IPC 445 } // namespace IPC
OLDNEW
« android_webview/native/aw_contents.cc ('K') | « ipc/ipc_channel_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698