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

Side by Side Diff: ppapi/shared_impl/resource_var.h

Issue 23346009: [PPAPI] Added a new Var subclass, ResourceVar. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added constructor that takes IPC::Message. Created 7 years, 3 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
OLDNEW
(Empty)
1 // Copyright 2013 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_SHARED_IMPL_RESOURCE_VAR_H_
6 #define PPAPI_SHARED_IMPL_RESOURCE_VAR_H_
7
8 #include "ipc/ipc_message.h"
9 #include "ppapi/c/pp_resource.h"
10 #include "ppapi/c/pp_var.h"
11 #include "ppapi/shared_impl/ppapi_shared_export.h"
12 #include "ppapi/shared_impl/var.h"
13
14 namespace ppapi {
15
16 // Represents a resource Var.
17 class PPAPI_SHARED_EXPORT ResourceVar : public Var {
18 public:
19 // Makes a null resource var.
20 ResourceVar();
21
22 // Makes a resource var with an existing plugin-side resource.
23 ResourceVar(PP_Resource resource_id);
yzshen1 2013/08/28 17:31:58 explicit?
Matt Giuca 2013/08/29 01:44:47 Done.
24
25 // Makes a resource var with a pending resource host.
26 // The |creation_message| contains instructions on how to create the
27 // plugin-side resource host. Its type depends on the type of resource.
yzshen1 2013/08/28 17:31:58 rule of thumb: "resource host" at the brower/rende
Matt Giuca 2013/08/29 01:44:47 Done.
28 ResourceVar(const IPC::Message& creation_message);
yzshen1 2013/08/28 17:31:58 explicit, please.
Matt Giuca 2013/08/29 01:44:47 Done.
29
30 virtual ~ResourceVar();
31
32 // Gets the resource ID associated with this var.
33 // This is 0 if a resource is still pending.
34 PP_Resource resource_id() const { return resource_id_; }
yzshen1 2013/08/28 17:31:58 To be more consistent with other code, please cons
Matt Giuca 2013/08/29 01:44:47 Done.
35
36 // Gets the message for creating a plugin-side resource.
37 // May be an empty message.
38 const IPC::Message& creation_message() const { return creation_message_; }
39
40 // Var override.
41 virtual ResourceVar* AsResourceVar() OVERRIDE;
42 virtual PP_VarType GetType() const OVERRIDE;
43
44 // Helper function that converts a PP_Var to a ResourceVar. This will
45 // return NULL if the PP_Var is not of Resource type.
46 static ResourceVar* FromPPVar(PP_Var var);
47
48 private:
49 // Real resource ID in the plugin. 0 if one has not yet been created
50 // (indicating that there is a pending host resource).
51 PP_Resource resource_id_;
yzshen1 2013/08/28 17:31:58 Are you planning to use this same ResourceVar clas
Matt Giuca 2013/08/29 01:44:47 I haven't thought much about the reference countin
yzshen1 2013/08/30 00:25:27 Correct. This part is relatively easy.
Matt Giuca 2013/08/30 02:55:20 Thanks for explaining. OK it sounds like none of
52
53 // If the plugin-side resource has not yet been created, carries a message to
54 // create a resource of the specific type on the plugin side.
55 // Otherwise, carries an empty message.
56 IPC::Message creation_message_;
57
58 DISALLOW_COPY_AND_ASSIGN(ResourceVar);
59 };
60
61 } // namespace ppapi
62
63 #endif // PPAPI_SHARED_IMPL_RESOURCE_VAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698