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

Unified Diff: content/renderer/pepper/host_resource_var.h

Issue 23809016: [PPAPI] ResourceVar now reference counts its PP_Resource in the plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix Windows compile. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/pepper/host_resource_var.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/host_resource_var.h
diff --git a/content/renderer/pepper/host_resource_var.h b/content/renderer/pepper/host_resource_var.h
new file mode 100644
index 0000000000000000000000000000000000000000..79fe487041debc41db8e2d539d9c211ad78e5ed5
--- /dev/null
+++ b/content/renderer/pepper/host_resource_var.h
@@ -0,0 +1,53 @@
+// 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_CONTENT_RENDERER_PEPPER_HOST_RESOURCE_VAR_H_
+#define PPAPI_CONTENT_RENDERER_PEPPER_HOST_RESOURCE_VAR_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "ipc/ipc_message.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/shared_impl/resource_var.h"
+#include "ppapi/shared_impl/var.h"
+
+namespace content {
+
+// Represents a resource var, usable on the host side. Can either have a
+// plugin-side resource or a pending resource host.
+class HostResourceVar : public ppapi::ResourceVar {
+ public:
+ // Makes a null resource var.
+ HostResourceVar();
+
+ // Makes a resource var with an existing plugin-side resource.
+ explicit HostResourceVar(PP_Resource pp_resource);
+
+ // Makes a resource var with a pending resource host.
+ // The |creation_message| contains data needed to create the plugin-side
+ // resource. Its type depends on the type of resource.
+ explicit HostResourceVar(const IPC::Message& creation_message);
+
+ // ResourceVar override.
+ virtual PP_Resource GetPPResource() const OVERRIDE;
+ virtual const IPC::Message* GetCreationMessage() const OVERRIDE;
+ virtual bool IsPending() const OVERRIDE;
+
+ protected:
+ virtual ~HostResourceVar();
+
+ 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 pp_resource_;
+
+ // 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, NULL.
+ scoped_ptr<IPC::Message> creation_message_;
+
+ DISALLOW_COPY_AND_ASSIGN(HostResourceVar);
+};
+
+} // namespace content
+
+#endif
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/pepper/host_resource_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698