OLD | NEW |
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 "ppapi/host/resource_host.h" | 5 #include "ppapi/host/resource_host.h" |
6 | 6 |
| 7 #include "base/logging.h" |
7 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/host/ppapi_host.h" | 9 #include "ppapi/host/ppapi_host.h" |
9 #include "ppapi/host/resource_message_filter.h" | 10 #include "ppapi/host/resource_message_filter.h" |
10 | 11 |
11 namespace ppapi { | 12 namespace ppapi { |
12 namespace host { | 13 namespace host { |
13 | 14 |
14 ResourceHost::ResourceHost(PpapiHost* host, | 15 ResourceHost::ResourceHost(PpapiHost* host, |
15 PP_Instance instance, | 16 PP_Instance instance, |
16 PP_Resource resource) | 17 PP_Resource resource) |
(...skipping 12 matching lines...) Expand all Loading... |
29 // First see if the message is handled off-thread by message filters. | 30 // First see if the message is handled off-thread by message filters. |
30 for (size_t i = 0; i < message_filters_.size(); ++i) { | 31 for (size_t i = 0; i < message_filters_.size(); ++i) { |
31 if (message_filters_[i]->HandleMessage(msg, context)) | 32 if (message_filters_[i]->HandleMessage(msg, context)) |
32 return true; | 33 return true; |
33 } | 34 } |
34 // Run this ResourceHosts message handler. | 35 // Run this ResourceHosts message handler. |
35 RunMessageHandlerAndReply(msg, context); | 36 RunMessageHandlerAndReply(msg, context); |
36 return true; | 37 return true; |
37 } | 38 } |
38 | 39 |
| 40 void ResourceHost::SetPPResourceForPendingHost(PP_Resource pp_resource) { |
| 41 DCHECK(!pp_resource_); |
| 42 pp_resource_ = pp_resource; |
| 43 DidConnectPendingHostToResource(); |
| 44 } |
| 45 |
39 void ResourceHost::SendReply(const ReplyMessageContext& context, | 46 void ResourceHost::SendReply(const ReplyMessageContext& context, |
40 const IPC::Message& msg) { | 47 const IPC::Message& msg) { |
41 host_->SendReply(context, msg); | 48 host_->SendReply(context, msg); |
42 } | 49 } |
43 | 50 |
44 void ResourceHost::AddFilter(scoped_refptr<ResourceMessageFilter> filter) { | 51 void ResourceHost::AddFilter(scoped_refptr<ResourceMessageFilter> filter) { |
45 message_filters_.push_back(filter); | 52 message_filters_.push_back(filter); |
46 filter->OnFilterAdded(this); | 53 filter->OnFilterAdded(this); |
47 } | 54 } |
48 | 55 |
49 } // namespace host | 56 } // namespace host |
50 } // namespace ppapi | 57 } // namespace ppapi |
OLD | NEW |