Invalidate scans when the host volume is unmounted.
[chromium-blink-merge.git] / ppapi / host / resource_host.cc
blob2d5af581fcf6c390115c4da039705030200c6586
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::IsCompositorHost() {
52 return false;
55 bool ResourceHost::IsFileRefHost() {
56 return false;
59 bool ResourceHost::IsFileSystemHost() {
60 return false;
63 bool ResourceHost::IsMediaStreamVideoTrackHost() {
64 return false;
67 bool ResourceHost::IsGraphics2DHost() {
68 return false;
71 void ResourceHost::AddFilter(scoped_refptr<ResourceMessageFilter> filter) {
72 message_filters_.push_back(filter);
73 filter->OnFilterAdded(this);
76 } // namespace host
77 } // namespace ppapi