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

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, 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 unified diff | Download patch | Annotate | Revision Log
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 |*optional_reply|.
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 // |optional_reply|. However, if you have a reply more than just the int32_t
46 // result code, just set |*optional_reply| to be the message of your
dmichael (off chromium) 2012/06/22 16:56:49 s/optional_reply/context.reply_msg? Or... maybe
brettw 2012/06/24 04:42:08 Why there's a weird in/out struct is a long story:
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

Powered by Google App Engine
This is Rietveld 408576698