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

Unified Diff: ppapi/host/resource_host.h

Issue 10572040: Create a PPAPI host for new resource message routing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/host/ppapi_host_export.h ('k') | ppapi/host/resource_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/host/resource_host.h
diff --git a/ppapi/host/resource_host.h b/ppapi/host/resource_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..c1e4b745ba7591ee9dd533467e4ea9f86aa1944a
--- /dev/null
+++ b/ppapi/host/resource_host.h
@@ -0,0 +1,66 @@
+// 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_RESOURCE_HOST_H_
+#define PPAPI_HOST_RESOURCE_HOST_H_
+
+#include "base/basictypes.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/host/ppapi_host_export.h"
+#include "ppapi/shared_impl/host_resource.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace host {
+
+struct HostMessageContext;
+class PpapiHost;
+
+// Some (but not all) resources have a corresponding object in the host side
+// that is kept alive as long as the resource in the plugin is alive. This is
+// the base class for such objects.
+class PPAPI_HOST_EXPORT ResourceHost {
+ public:
+ ResourceHost(PpapiHost* host, PP_Instance instance, PP_Resource resource);
+ virtual ~ResourceHost();
+
+ PpapiHost* host() { return host_; }
+ PP_Instance pp_instance() const { return pp_instance_; }
+ PP_Resource pp_resource() const { return pp_resource_; }
+
+ // Handles messages associated with a given resource object. If the flags
+ // indicate that a response is required, the return value of this function
+ // will be sent as a resource message "response" along with the message
+ // specified in the reply of the context.
+ //
+ // You can do a response asynchronously by returning PP_OK_COMPLETIONPENDING.
+ // This will cause the reply to be skipped, and the class implementing this
+ // function will take responsibility for issuing the callback later.
+ //
+ // If you don't have a particular reply message, you can just ignore
+ // the reply in the message context. However, if you have a reply more than
+ // just the int32_t result code, set the reply to be the message of your
+ // choosing.
+ //
+ // The default implementation just returns PP_ERROR_NOTSUPPORTED.
+ virtual int32_t OnResourceMessageReceived(const IPC::Message& msg,
+ HostMessageContext* context);
+
+ private:
+ // The host that owns this object.
+ PpapiHost* host_;
+
+ PP_Instance pp_instance_;
+ PP_Resource pp_resource_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResourceHost);
+};
+
+} // namespace host
+} // namespace ppapi
+
+#endif // PPAPI_HOST_RESOURCE_HOST_H_
« no previous file with comments | « ppapi/host/ppapi_host_export.h ('k') | ppapi/host/resource_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698