cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / host / resource_host.cc
blob4e12260517eb63f8a3fb76a27aee407a11ff45b9
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
3 // found in the LICENSE file.
5 #include "ppapi/host/resource_host.h"
7 #include "base/logging.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/host/ppapi_host.h"
10 #include "ppapi/host/resource_message_filter.h"
12 namespace ppapi {
13 namespace host {
15 ResourceHost::ResourceHost(PpapiHost* host,
16 PP_Instance instance,
17 PP_Resource resource)
18 : host_(host),
19 pp_instance_(instance),
20 pp_resource_(resource) {
23 ResourceHost::~ResourceHost() {
24 for (size_t i = 0; i < message_filters_.size(); ++i)
25 message_filters_[i]->OnFilterDestroyed();
28 bool ResourceHost::HandleMessage(const IPC::Message& msg,
29 HostMessageContext* context) {
30 // First see if the message is handled off-thread by message filters.
31 for (size_t i = 0; i < message_filters_.size(); ++i) {
32 if (message_filters_[i]->HandleMessage(msg, context))
33 return true;
35 // Run this ResourceHosts message handler.
36 RunMessageHandlerAndReply(msg, context);
37 return true;
40 void ResourceHost::SetPPResourceForPendingHost(PP_Resource pp_resource) {
41 DCHECK(!pp_resource_);
42 pp_resource_ = pp_resource;
43 DidConnectPendingHostToResource();
46 void ResourceHost::SendReply(const ReplyMessageContext& context,
47 const IPC::Message& msg) {
48 host_->SendReply(context, msg);
51 bool ResourceHost::IsFileRefHost() {
52 return false;
55 bool ResourceHost::IsFileSystemHost() {
56 return false;
59 bool ResourceHost::IsGraphics2DHost() {
60 return false;
63 void ResourceHost::AddFilter(scoped_refptr<ResourceMessageFilter> filter) {
64 message_filters_.push_back(filter);
65 filter->OnFilterAdded(this);
68 } // namespace host
69 } // namespace ppapi