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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CONTENT_RENDERER_PEPPER_HOST_RESOURCE_VAR_H_
6 #define PPAPI_CONTENT_RENDERER_PEPPER_HOST_RESOURCE_VAR_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "ipc/ipc_message.h"
10 #include "ppapi/c/pp_resource.h"
11 #include "ppapi/shared_impl/resource_var.h"
12 #include "ppapi/shared_impl/var.h"
13
14 namespace content {
15
16 // Represents a resource var, usable on the host side. Can either have a
17 // plugin-side resource or a pending resource host.
18 class HostResourceVar : public ppapi::ResourceVar {
19 public:
20 // Makes a null resource var.
21 HostResourceVar();
22
23 // Makes a resource var with an existing plugin-side resource.
24 explicit HostResourceVar(PP_Resource pp_resource);
25
26 // Makes a resource var with a pending resource host.
27 // The |creation_message| contains data needed to create the plugin-side
28 // resource. Its type depends on the type of resource.
29 explicit HostResourceVar(const IPC::Message& creation_message);
30
31 // ResourceVar override.
32 virtual PP_Resource GetPPResource() const OVERRIDE;
33 virtual const IPC::Message* GetCreationMessage() const OVERRIDE;
34 virtual bool IsPending() const OVERRIDE;
35
36 protected:
37 virtual ~HostResourceVar();
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 pp_resource_;
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. Otherwise, NULL.
46 scoped_ptr<IPC::Message> creation_message_;
47
48 DISALLOW_COPY_AND_ASSIGN(HostResourceVar);
49 };
50
51 } // namespace content
52
53 #endif
OLDNEW
« 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