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

Side by Side Diff: ppapi/host/resource_host.h

Issue 11414147: Add ability to create pending resource hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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.cc ('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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_HOST_RESOURCE_HOST_H_ 5 #ifndef PPAPI_HOST_RESOURCE_HOST_H_
6 #define PPAPI_HOST_RESOURCE_HOST_H_ 6 #define PPAPI_HOST_RESOURCE_HOST_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 25 matching lines...) Expand all
36 PpapiHost* host() { return host_; } 36 PpapiHost* host() { return host_; }
37 PP_Instance pp_instance() const { return pp_instance_; } 37 PP_Instance pp_instance() const { return pp_instance_; }
38 PP_Resource pp_resource() const { return pp_resource_; } 38 PP_Resource pp_resource() const { return pp_resource_; }
39 39
40 // This runs any message filters in |message_filters_|. If the message is not 40 // This runs any message filters in |message_filters_|. If the message is not
41 // handled by these filters then the host's own message handler is run. True 41 // handled by these filters then the host's own message handler is run. True
42 // is always returned (the message will always be handled in some way). 42 // is always returned (the message will always be handled in some way).
43 virtual bool HandleMessage(const IPC::Message& msg, 43 virtual bool HandleMessage(const IPC::Message& msg,
44 HostMessageContext* context) OVERRIDE; 44 HostMessageContext* context) OVERRIDE;
45 45
46 // Sets the PP_Resource ID when the plugin attaches to a pending resource
47 // host. This will notify subclasses by calling
48 // DidConnectPendingHostToResource.
49 //
50 // The current PP_Resource for all pending hosts should be 0. See
51 // PpapiHostMsg_AttachToPendingHost.
52 void SetPPResourceForPendingHost(PP_Resource pp_resource);
53
46 virtual void SendReply(const ReplyMessageContext& context, 54 virtual void SendReply(const ReplyMessageContext& context,
47 const IPC::Message& msg) OVERRIDE; 55 const IPC::Message& msg) OVERRIDE;
48 56
49 virtual bool IsGraphics2DHost() const { return false; } 57 virtual bool IsGraphics2DHost() const { return false; }
50 58
51 protected: 59 protected:
52 // Adds a ResourceMessageFilter to handle resource messages. Incoming 60 // Adds a ResourceMessageFilter to handle resource messages. Incoming
53 // messages will be passed to the handlers of these filters before being 61 // messages will be passed to the handlers of these filters before being
54 // handled by the resource host's own message handler. This allows 62 // handled by the resource host's own message handler. This allows
55 // ResourceHosts to easily handle messages on other threads. 63 // ResourceHosts to easily handle messages on other threads.
56 void AddFilter(scoped_refptr<ResourceMessageFilter> filter); 64 void AddFilter(scoped_refptr<ResourceMessageFilter> filter);
57 65
66 // Called when this resource host is pending and the corresponding plugin has
67 // just connected to it. The host resource subclass can implement this
68 // function if it wants to do processing (typically sending queued data).
69 //
70 // The PP_Resource will be valid for this call but not before.
71 virtual void DidConnectPendingHostToResource() {}
72
58 private: 73 private:
59 // The host that owns this object. 74 // The host that owns this object.
60 PpapiHost* host_; 75 PpapiHost* host_;
61 76
62 PP_Instance pp_instance_; 77 PP_Instance pp_instance_;
63 PP_Resource pp_resource_; 78 PP_Resource pp_resource_;
64 79
65 // A vector of message filters which the host will forward incoming resource 80 // A vector of message filters which the host will forward incoming resource
66 // messages to. 81 // messages to.
67 std::vector<scoped_refptr<ResourceMessageFilter> > message_filters_; 82 std::vector<scoped_refptr<ResourceMessageFilter> > message_filters_;
68 83
69 DISALLOW_COPY_AND_ASSIGN(ResourceHost); 84 DISALLOW_COPY_AND_ASSIGN(ResourceHost);
70 }; 85 };
71 86
72 } // namespace host 87 } // namespace host
73 } // namespace ppapi 88 } // namespace ppapi
74 89
75 #endif // PPAPI_HOST_RESOURCE_HOST_H_ 90 #endif // PPAPI_HOST_RESOURCE_HOST_H_
OLDNEW
« no previous file with comments | « ppapi/host/ppapi_host.cc ('k') | ppapi/host/resource_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698