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

Unified 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: Moved ResourceVar to a new file. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/ppapi_shared.gypi ('k') | ppapi/shared_impl/resource_var.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/resource_var.h
diff --git a/ppapi/shared_impl/resource_var.h b/ppapi/shared_impl/resource_var.h
new file mode 100644
index 0000000000000000000000000000000000000000..975c18b340beaa1e02a161c5bbe77cd5e86fa144
--- /dev/null
+++ b/ppapi/shared_impl/resource_var.h
@@ -0,0 +1,54 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_SHARED_IMPL_RESOURCE_VAR_H_
+#define PPAPI_SHARED_IMPL_RESOURCE_VAR_H_
+
+#include "ipc/ipc_message.h"
Matt Giuca 2013/08/28 07:12:14 Note: This violates a deps rule (shared_impl can't
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "ppapi/shared_impl/var.h"
+
+namespace ppapi {
+
+// Represents a resource Var.
+class PPAPI_SHARED_EXPORT ResourceVar : public Var {
+ public:
+ ResourceVar(); // Makes a null resource var.
+ ResourceVar(PP_Resource resource_id);
+ virtual ~ResourceVar();
+
+ // Gets the resource ID associated with this var.
+ // This is 0 if a resource is still pending.
+ PP_Resource resource_id() const { return resource_id_; }
+
+ // Gets the message for creating a plugin-side resource.
+ // May be an empty message.
+ const IPC::Message& creation_message() const { return creation_message_; }
+
+ // Var override.
+ virtual ResourceVar* AsResourceVar() OVERRIDE;
+ virtual PP_VarType GetType() const OVERRIDE;
+
+ // Helper function that converts a PP_Var to a ResourceVar. This will
+ // return NULL if the PP_Var is not of Resource type.
+ static ResourceVar* FromPPVar(PP_Var var);
+
+ private:
+ // Real resource ID in the plugin. 0 if one has not yet been created
+ // (indicating that there is a pending host resource).
+ PP_Resource resource_id_;
+
+ // If the plugin-side resource has not yet been created, carries a message to
+ // create a resource of the specific type on the plugin side.
+ // Otherwise, carries an empty message.
+ IPC::Message creation_message_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResourceVar);
+};
+
+} // namespace ppapi
+
+#endif // PPAPI_SHARED_IMPL_RESOURCE_VAR_H_
« no previous file with comments | « ppapi/ppapi_shared.gypi ('k') | ppapi/shared_impl/resource_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698