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

Side by Side Diff: webkit/plugins/ppapi/npobject_var.cc

Issue 8930010: Implement in-process PPB_VarArrayBuffer_Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.h ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "webkit/plugins/ppapi/npobject_var.h" 5 #include "webkit/plugins/ppapi/npobject_var.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_var.h" 8 #include "ppapi/c/pp_var.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
10 #include "webkit/plugins/ppapi/host_globals.h" 10 #include "webkit/plugins/ppapi/host_globals.h"
(...skipping 17 matching lines...) Expand all
28 NPObjectVar::~NPObjectVar() { 28 NPObjectVar::~NPObjectVar() {
29 if (pp_instance()) 29 if (pp_instance())
30 HostGlobals::Get()->host_var_tracker()->RemoveNPObjectVar(this); 30 HostGlobals::Get()->host_var_tracker()->RemoveNPObjectVar(this);
31 WebBindings::releaseObject(np_object_); 31 WebBindings::releaseObject(np_object_);
32 } 32 }
33 33
34 NPObjectVar* NPObjectVar::AsNPObjectVar() { 34 NPObjectVar* NPObjectVar::AsNPObjectVar() {
35 return this; 35 return this;
36 } 36 }
37 37
38 PP_Var NPObjectVar::GetPPVar() {
39 int32 id = GetOrCreateVarID();
40 if (!id)
41 return PP_MakeNull();
42
43 PP_Var result;
44 result.type = PP_VARTYPE_OBJECT;
45 result.value.as_id = id;
46 return result;
47 }
48
49 PP_VarType NPObjectVar::GetType() const { 38 PP_VarType NPObjectVar::GetType() const {
50 return PP_VARTYPE_OBJECT; 39 return PP_VARTYPE_OBJECT;
51 } 40 }
52 41
53 void NPObjectVar::InstanceDeleted() { 42 void NPObjectVar::InstanceDeleted() {
54 DCHECK(pp_instance_); 43 DCHECK(pp_instance_);
55 pp_instance_ = 0; 44 pp_instance_ = 0;
56 } 45 }
57 46
58 // static 47 // static
59 scoped_refptr<NPObjectVar> NPObjectVar::FromPPVar(PP_Var var) { 48 scoped_refptr<NPObjectVar> NPObjectVar::FromPPVar(PP_Var var) {
60 if (var.type != PP_VARTYPE_OBJECT) 49 if (var.type != PP_VARTYPE_OBJECT)
61 return scoped_refptr<NPObjectVar>(NULL); 50 return scoped_refptr<NPObjectVar>(NULL);
62 scoped_refptr<Var> var_object( 51 scoped_refptr<Var> var_object(
63 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 52 PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
64 if (!var_object) 53 if (!var_object)
65 return scoped_refptr<NPObjectVar>(); 54 return scoped_refptr<NPObjectVar>();
66 return scoped_refptr<NPObjectVar>(var_object->AsNPObjectVar()); 55 return scoped_refptr<NPObjectVar>(var_object->AsNPObjectVar());
67 } 56 }
68 57
69 } // namespace ppapi 58 } // namespace ppapi
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.h ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698