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

Side by Side Diff: ppapi/shared_impl/resource.cc

Issue 174213003: PPAPI: Use clang-format on ppapi/shared_impl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove DEPS Created 6 years, 10 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 | « ppapi/shared_impl/resource.h ('k') | ppapi/shared_impl/resource_tracker.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ppapi/shared_impl/resource.h" 5 #include "ppapi/shared_impl/resource.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/shared_impl/resource_tracker.h" 8 #include "ppapi/shared_impl/resource_tracker.h"
9 #include "ppapi/shared_impl/ppapi_globals.h" 9 #include "ppapi/shared_impl/ppapi_globals.h"
10 10
(...skipping 26 matching lines...) Expand all
37 37
38 // See previous constructor. 38 // See previous constructor.
39 host_resource_.SetHostResource(host_resource.instance(), pp_resource_); 39 host_resource_.SetHostResource(host_resource.instance(), pp_resource_);
40 } 40 }
41 } 41 }
42 42
43 Resource::Resource(Untracked) { 43 Resource::Resource(Untracked) {
44 pp_resource_ = PpapiGlobals::Get()->GetResourceTracker()->AddResource(this); 44 pp_resource_ = PpapiGlobals::Get()->GetResourceTracker()->AddResource(this);
45 } 45 }
46 46
47 Resource::~Resource() { 47 Resource::~Resource() { RemoveFromResourceTracker(); }
48 RemoveFromResourceTracker();
49 }
50 48
51 PP_Resource Resource::GetReference() { 49 PP_Resource Resource::GetReference() {
52 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(pp_resource()); 50 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(pp_resource());
53 return pp_resource(); 51 return pp_resource();
54 } 52 }
55 53
56 void Resource::NotifyLastPluginRefWasDeleted() { 54 void Resource::NotifyLastPluginRefWasDeleted() {
57 // Notify subclasses. 55 // Notify subclasses.
58 LastPluginRefWasDeleted(); 56 LastPluginRefWasDeleted();
59 } 57 }
60 58
61 void Resource::NotifyInstanceWasDeleted() { 59 void Resource::NotifyInstanceWasDeleted() {
62 // Hold a reference, because InstanceWasDeleted() may cause us to be 60 // Hold a reference, because InstanceWasDeleted() may cause us to be
63 // destroyed. 61 // destroyed.
64 scoped_refptr<Resource> keep_alive(this); 62 scoped_refptr<Resource> keep_alive(this);
65 63
66 // Notify subclasses. 64 // Notify subclasses.
67 InstanceWasDeleted(); 65 InstanceWasDeleted();
68 66
69 host_resource_ = HostResource(); 67 host_resource_ = HostResource();
70 } 68 }
71 69
72 void Resource::OnReplyReceived(const proxy::ResourceMessageReplyParams& params, 70 void Resource::OnReplyReceived(const proxy::ResourceMessageReplyParams& params,
73 const IPC::Message& msg) { 71 const IPC::Message& msg) {
74 NOTREACHED(); 72 NOTREACHED();
75 } 73 }
76 74
77 void Resource::Log(PP_LogLevel level, const std::string& message) { 75 void Resource::Log(PP_LogLevel level, const std::string& message) {
78 PpapiGlobals::Get()->LogWithSource(pp_instance(), level, std::string(), 76 PpapiGlobals::Get()->LogWithSource(
79 message); 77 pp_instance(), level, std::string(), message);
80 } 78 }
81 79
82 void Resource::RemoveFromResourceTracker() { 80 void Resource::RemoveFromResourceTracker() {
83 PpapiGlobals::Get()->GetResourceTracker()->RemoveResource(this); 81 PpapiGlobals::Get()->GetResourceTracker()->RemoveResource(this);
84 } 82 }
85 83
86 #define DEFINE_TYPE_GETTER(RESOURCE) \ 84 #define DEFINE_TYPE_GETTER(RESOURCE) \
87 thunk::RESOURCE* Resource::As##RESOURCE() { return NULL; } 85 thunk::RESOURCE* Resource::As##RESOURCE() { return NULL; }
88 FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_TYPE_GETTER) 86 FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_TYPE_GETTER)
89 #undef DEFINE_TYPE_GETTER 87 #undef DEFINE_TYPE_GETTER
90 88
91 } // namespace ppapi 89 } // namespace ppapi
92
OLDNEW
« no previous file with comments | « ppapi/shared_impl/resource.h ('k') | ppapi/shared_impl/resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698