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

Side by Side Diff: ppapi/host/ppapi_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/host_message_context.h ('k') | ppapi/host/ppapi_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_PPAPI_HOST_H_
6 #define PPAPI_HOST_PPAPI_HOST_H_
7
8 #include <map>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/linked_ptr.h"
12 #include "ipc/ipc_listener.h"
13 #include "ipc/ipc_sender.h"
14 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/host/ppapi_host_export.h"
17
18 namespace ppapi {
19
20 namespace proxy {
21 class ResourceMessageCallParams;
22 class ResourceMessageReplyParams;
23 }
24
25 namespace host {
26
27 class HostFactory;
28 class ResourceHost;
29
30 // The host provides routing and tracking for resource message calls that
31 // come from the plugin to the host (browser or renderer), and the
32 // corresponding replies.
33 class PPAPI_HOST_EXPORT PpapiHost : public IPC::Sender, public IPC::Listener {
34 public:
35 // The sender is the channel to the plugin for outgoing messages. The factory
36 // will be used to receive resource creation messages from the plugin. Both
37 // pointers are owned by the caller and must outlive this class.
38 PpapiHost(IPC::Sender* sender,
39 HostFactory* host_factory);
40 virtual ~PpapiHost();
41
42 // Sender implementation. Forwards to the sender_.
43 virtual bool Send(IPC::Message* msg) OVERRIDE;
44
45 // Listener implementation.
46 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
47
48 // Sends the given reply message to the plugin.
49 void SendReply(const proxy::ResourceMessageReplyParams& params,
50 const IPC::Message& msg);
51
52 private:
53 // Message handlers.
54 void OnHostMsgResourceCall(const proxy::ResourceMessageCallParams& params,
55 const IPC::Message& nested_msg);
56 void OnHostMsgResourceCreated(const proxy::ResourceMessageCallParams& param,
57 PP_Instance instance,
58 const IPC::Message& nested_msg);
59 void OnHostMsgResourceDestroyed(PP_Resource resource);
60
61 // Returns null if the resource doesn't exist.
62 host::ResourceHost* GetResourceHost(PP_Resource resource);
63
64 // Non-owning pointer.
65 IPC::Sender* sender_;
66
67 // Non-owning pointer.
68 HostFactory* host_factory_;
69
70 typedef std::map<PP_Resource, linked_ptr<ResourceHost> > ResourceMap;
71 ResourceMap resources_;
72
73 DISALLOW_COPY_AND_ASSIGN(PpapiHost);
74 };
75
76 } // namespace host
77 } // namespace ppapi
78
79 #endif // PPAPI_HOST_PPAPIE_HOST_H_
OLDNEW
« no previous file with comments | « ppapi/host/host_message_context.h ('k') | ppapi/host/ppapi_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698