OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_SHARED_IMPL_RESOURCE_VAR_H_ | 5 #ifndef PPAPI_SHARED_IMPL_RESOURCE_VAR_H_ |
6 #define PPAPI_SHARED_IMPL_RESOURCE_VAR_H_ | 6 #define PPAPI_SHARED_IMPL_RESOURCE_VAR_H_ |
7 | 7 |
8 #include "ppapi/c/pp_resource.h" | 8 #include "ppapi/c/pp_resource.h" |
9 #include "ppapi/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
10 #include "ppapi/shared_impl/ppapi_shared_export.h" | 10 #include "ppapi/shared_impl/ppapi_shared_export.h" |
11 #include "ppapi/shared_impl/var.h" | 11 #include "ppapi/shared_impl/var.h" |
12 | 12 |
13 namespace IPC { | 13 namespace IPC { |
14 class Message; | 14 class Message; |
15 } | 15 } |
16 | 16 |
17 namespace ppapi { | 17 namespace ppapi { |
18 | 18 |
19 // Represents a resource Var. | 19 // Represents a resource Var. |
20 class PPAPI_SHARED_EXPORT ResourceVar : public Var { | 20 class PPAPI_SHARED_EXPORT ResourceVar : public Var { |
21 public: | 21 public: |
22 // Gets the resource ID associated with this var. | 22 // Gets the resource ID associated with this var. |
23 // This is 0 if a resource is still pending (only possible on the host side). | 23 // This is 0 if a resource is still pending (only possible on the host side). |
24 // NOTE: This can return a PP_Resource with a reference count of 0 on the | 24 // NOTE: This can return a PP_Resource with a reference count of 0 on the |
25 // plugin side. It should be AddRef'd if the resource is passed to the user. | 25 // plugin side. It should be AddRef'd if the resource is passed to the user. |
26 virtual PP_Resource GetPPResource() const = 0; | 26 virtual PP_Resource GetPPResource() const = 0; |
27 | 27 |
| 28 // Gets the pending resource host ID in the renderer. |
| 29 virtual int GetPendingRendererHostId() const; |
| 30 |
| 31 // Gets the pending resource host ID in the browser. |
| 32 virtual int GetPendingBrowserHostId() const; |
| 33 |
28 // Gets the message for creating a plugin-side resource. Returns NULL if the | 34 // Gets the message for creating a plugin-side resource. Returns NULL if the |
29 // message is empty (which is always true on the plugin side). | 35 // message is empty (which is always true on the plugin side). |
30 virtual const IPC::Message* GetCreationMessage() const; | 36 virtual const IPC::Message* GetCreationMessage() const; |
31 | 37 |
32 // Determines whether this is a pending resource. | 38 // Determines whether this is a pending resource. |
33 // This is true if, on the host side, the there is a creation_message and no | 39 // This is true if, on the host side, the there is a creation_message and no |
34 // PP_Resource. | 40 // PP_Resource. |
35 virtual bool IsPending() const = 0; | 41 virtual bool IsPending() const = 0; |
36 | 42 |
37 // Var override. | 43 // Var override. |
38 virtual ResourceVar* AsResourceVar() OVERRIDE; | 44 virtual ResourceVar* AsResourceVar() OVERRIDE; |
39 virtual PP_VarType GetType() const OVERRIDE; | 45 virtual PP_VarType GetType() const OVERRIDE; |
40 | 46 |
41 // Helper function that converts a PP_Var to a ResourceVar. This will | 47 // Helper function that converts a PP_Var to a ResourceVar. This will |
42 // return NULL if the PP_Var is not of Resource type. | 48 // return NULL if the PP_Var is not of Resource type. |
43 static ResourceVar* FromPPVar(PP_Var var); | 49 static ResourceVar* FromPPVar(PP_Var var); |
44 | 50 |
45 protected: | 51 protected: |
46 ResourceVar(); | 52 ResourceVar(); |
47 | 53 |
48 virtual ~ResourceVar(); | 54 virtual ~ResourceVar(); |
49 | 55 |
50 private: | 56 private: |
51 DISALLOW_COPY_AND_ASSIGN(ResourceVar); | 57 DISALLOW_COPY_AND_ASSIGN(ResourceVar); |
52 }; | 58 }; |
53 | 59 |
54 } // namespace ppapi | 60 } // namespace ppapi |
55 | 61 |
56 #endif // PPAPI_SHARED_IMPL_RESOURCE_VAR_H_ | 62 #endif // PPAPI_SHARED_IMPL_RESOURCE_VAR_H_ |
OLD | NEW |