OLD | NEW |
---|---|
(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" | |
Matt Giuca
2013/08/28 07:12:14
Note: This violates a deps rule (shared_impl can't
| |
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 ResourceVar(); // Makes a null resource var. | |
20 ResourceVar(PP_Resource resource_id); | |
21 virtual ~ResourceVar(); | |
22 | |
23 // Gets the resource ID associated with this var. | |
24 // This is 0 if a resource is still pending. | |
25 PP_Resource resource_id() const { return resource_id_; } | |
26 | |
27 // Gets the message for creating a plugin-side resource. | |
28 // May be an empty message. | |
29 const IPC::Message& creation_message() const { return creation_message_; } | |
30 | |
31 // Var override. | |
32 virtual ResourceVar* AsResourceVar() OVERRIDE; | |
33 virtual PP_VarType GetType() const OVERRIDE; | |
34 | |
35 // Helper function that converts a PP_Var to a ResourceVar. This will | |
36 // return NULL if the PP_Var is not of Resource type. | |
37 static ResourceVar* FromPPVar(PP_Var var); | |
38 | |
39 private: | |
40 // Real resource ID in the plugin. 0 if one has not yet been created | |
41 // (indicating that there is a pending host resource). | |
42 PP_Resource resource_id_; | |
43 | |
44 // If the plugin-side resource has not yet been created, carries a message to | |
45 // create a resource of the specific type on the plugin side. | |
46 // Otherwise, carries an empty message. | |
47 IPC::Message creation_message_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(ResourceVar); | |
50 }; | |
51 | |
52 } // namespace ppapi | |
53 | |
54 #endif // PPAPI_SHARED_IMPL_RESOURCE_VAR_H_ | |
OLD | NEW |