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

Side by Side 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, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/host/ppapi_host_export.h ('k') | ppapi/host/resource_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef PPAPI_HOST_RESOURCE_HOST_H_
6 #define PPAPI_HOST_RESOURCE_HOST_H_
7
8 #include "base/basictypes.h"
9 #include "ppapi/c/pp_resource.h"
10 #include "ppapi/host/ppapi_host_export.h"
11 #include "ppapi/shared_impl/host_resource.h"
12
13 namespace IPC {
14 class Message;
15 }
16
17 namespace ppapi {
18 namespace host {
19
20 struct HostMessageContext;
21 class PpapiHost;
22
23 // Some (but not all) resources have a corresponding object in the host side
24 // that is kept alive as long as the resource in the plugin is alive. This is
25 // the base class for such objects.
26 class PPAPI_HOST_EXPORT ResourceHost {
27 public:
28 ResourceHost(PpapiHost* host, PP_Instance instance, PP_Resource resource);
29 virtual ~ResourceHost();
30
31 PpapiHost* host() { return host_; }
32 PP_Instance pp_instance() const { return pp_instance_; }
33 PP_Resource pp_resource() const { return pp_resource_; }
34
35 // Handles messages associated with a given resource object. If the flags
36 // indicate that a response is required, the return value of this function
37 // will be sent as a resource message "response" along with the message
38 // specified in the reply of the context.
39 //
40 // You can do a response asynchronously by returning PP_OK_COMPLETIONPENDING.
41 // This will cause the reply to be skipped, and the class implementing this
42 // function will take responsibility for issuing the callback later.
43 //
44 // If you don't have a particular reply message, you can just ignore
45 // the reply in the message context. However, if you have a reply more than
46 // just the int32_t result code, set the reply to be the message of your
47 // choosing.
48 //
49 // The default implementation just returns PP_ERROR_NOTSUPPORTED.
50 virtual int32_t OnResourceMessageReceived(const IPC::Message& msg,
51 HostMessageContext* context);
52
53 private:
54 // The host that owns this object.
55 PpapiHost* host_;
56
57 PP_Instance pp_instance_;
58 PP_Resource pp_resource_;
59
60 DISALLOW_COPY_AND_ASSIGN(ResourceHost);
61 };
62
63 } // namespace host
64 } // namespace ppapi
65
66 #endif // PPAPI_HOST_RESOURCE_HOST_H_
OLDNEW
« 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