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

Side by Side Diff: content/renderer/pepper/npobject_var.cc

Issue 225903006: PPAPI: Run clang_format.py on content/renderer/pepper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 8 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 | Annotate | Revision Log
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 "content/renderer/pepper/npobject_var.h" 5 #include "content/renderer/pepper/npobject_var.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/pepper/host_globals.h" 8 #include "content/renderer/pepper/host_globals.h"
9 #include "content/renderer/pepper/host_var_tracker.h" 9 #include "content/renderer/pepper/host_var_tracker.h"
10 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
11 #include "third_party/WebKit/public/web/WebBindings.h" 11 #include "third_party/WebKit/public/web/WebBindings.h"
12 12
13 using blink::WebBindings; 13 using blink::WebBindings;
14 14
15 namespace ppapi { 15 namespace ppapi {
16 16
17 // NPObjectVar ----------------------------------------------------------------- 17 // NPObjectVar -----------------------------------------------------------------
18 18
19 NPObjectVar::NPObjectVar(PP_Instance instance, 19 NPObjectVar::NPObjectVar(PP_Instance instance, NPObject* np_object)
20 NPObject* np_object) 20 : pp_instance_(instance), np_object_(np_object) {
21 : pp_instance_(instance),
22 np_object_(np_object) {
23 WebBindings::retainObject(np_object_); 21 WebBindings::retainObject(np_object_);
24 content::HostGlobals::Get()->host_var_tracker()->AddNPObjectVar(this); 22 content::HostGlobals::Get()->host_var_tracker()->AddNPObjectVar(this);
25 } 23 }
26 24
27 NPObjectVar::~NPObjectVar() { 25 NPObjectVar::~NPObjectVar() {
28 if (pp_instance()) 26 if (pp_instance())
29 content::HostGlobals::Get()->host_var_tracker()->RemoveNPObjectVar(this); 27 content::HostGlobals::Get()->host_var_tracker()->RemoveNPObjectVar(this);
30 WebBindings::releaseObject(np_object_); 28 WebBindings::releaseObject(np_object_);
31 } 29 }
32 30
33 NPObjectVar* NPObjectVar::AsNPObjectVar() { 31 NPObjectVar* NPObjectVar::AsNPObjectVar() { return this; }
34 return this;
35 }
36 32
37 PP_VarType NPObjectVar::GetType() const { 33 PP_VarType NPObjectVar::GetType() const { return PP_VARTYPE_OBJECT; }
38 return PP_VARTYPE_OBJECT;
39 }
40 34
41 void NPObjectVar::InstanceDeleted() { 35 void NPObjectVar::InstanceDeleted() {
42 DCHECK(pp_instance_); 36 DCHECK(pp_instance_);
43 content::HostGlobals::Get()->host_var_tracker()->RemoveNPObjectVar(this); 37 content::HostGlobals::Get()->host_var_tracker()->RemoveNPObjectVar(this);
44 pp_instance_ = 0; 38 pp_instance_ = 0;
45 } 39 }
46 40
47 // static 41 // static
48 scoped_refptr<NPObjectVar> NPObjectVar::FromPPVar(PP_Var var) { 42 scoped_refptr<NPObjectVar> NPObjectVar::FromPPVar(PP_Var var) {
49 if (var.type != PP_VARTYPE_OBJECT) 43 if (var.type != PP_VARTYPE_OBJECT)
50 return scoped_refptr<NPObjectVar>(NULL); 44 return scoped_refptr<NPObjectVar>(NULL);
51 scoped_refptr<Var> var_object( 45 scoped_refptr<Var> var_object(
52 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 46 PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
53 if (!var_object.get()) 47 if (!var_object.get())
54 return scoped_refptr<NPObjectVar>(); 48 return scoped_refptr<NPObjectVar>();
55 return scoped_refptr<NPObjectVar>(var_object->AsNPObjectVar()); 49 return scoped_refptr<NPObjectVar>(var_object->AsNPObjectVar());
56 } 50 }
57 51
58 } // namespace ppapi 52 } // namespace ppapi
OLDNEW
« no previous file with comments | « content/renderer/pepper/npapi_glue.cc ('k') | content/renderer/pepper/pepper_audio_input_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698