diff options
-rw-r--r-- | ppapi/host/message_filter_host.cc | 26 | ||||
-rw-r--r-- | ppapi/host/message_filter_host.h | 38 | ||||
-rw-r--r-- | ppapi/ppapi_host.gypi | 2 |
3 files changed, 66 insertions, 0 deletions
diff --git a/ppapi/host/message_filter_host.cc b/ppapi/host/message_filter_host.cc new file mode 100644 index 0000000..78ebd23 --- /dev/null +++ b/ppapi/host/message_filter_host.cc @@ -0,0 +1,26 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/host/message_filter_host.h" + +#include "ppapi/host/ppapi_host.h" +#include "ppapi/host/resource_message_filter.h" + +namespace ppapi { +namespace host { + +MessageFilterHost::MessageFilterHost( + PpapiHost* host, + PP_Instance instance, + PP_Resource resource, + const scoped_refptr<ResourceMessageFilter>& message_filter) + : ResourceHost(host, instance, resource) { + AddFilter(message_filter); +} + +MessageFilterHost::~MessageFilterHost() { +} + +} // namespace host +} // namespace ppapi
\ No newline at end of file diff --git a/ppapi/host/message_filter_host.h b/ppapi/host/message_filter_host.h new file mode 100644 index 0000000..9aa1c5b --- /dev/null +++ b/ppapi/host/message_filter_host.h @@ -0,0 +1,38 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_HOST_MESSAGE_FILTER_HOST_H_ +#define PPAPI_HOST_MESSAGE_FILTER_HOST_H_ + +#include "base/compiler_specific.h" +#include "base/memory/ref_counted.h" +#include "ppapi/host/ppapi_host_export.h" +#include "ppapi/host/resource_host.h" + +namespace ppapi { +namespace host { + +class PpapiHost; +class ResourceMessageFilter; + +// This class is a generic ResourceHost that is composed of a single +// ResourceMessageFilter. There are cases where ResourceHosts only serve the +// purpose of passing messages onto a message filter to be handled on another +// thread. This class can be used as the host in those cases. +class PPAPI_HOST_EXPORT MessageFilterHost : public ResourceHost { + public: + MessageFilterHost(PpapiHost* host, + PP_Instance instance, + PP_Resource resource, + const scoped_refptr<ResourceMessageFilter>& message_filter); + virtual ~MessageFilterHost(); + + private: + DISALLOW_COPY_AND_ASSIGN(MessageFilterHost); +}; + +} // namespace host +} // namespace ppapi + +#endif // PPAPI_HOST_MESSAGE_FILTER_HOST_H_ diff --git a/ppapi/ppapi_host.gypi b/ppapi/ppapi_host.gypi index 446a8289a..4031c77 100644 --- a/ppapi/ppapi_host.gypi +++ b/ppapi/ppapi_host.gypi @@ -27,6 +27,8 @@ 'host/host_message_context.h', 'host/instance_message_filter.cc', 'host/instance_message_filter.h', + 'host/message_filter_host.cc', + 'host/message_filter_host.h', 'host/ppapi_host.cc', 'host/ppapi_host.h', 'host/ppapi_host_export.h', |