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

Side by Side Diff: ppapi/thunk/enter.cc

Issue 10168026: Delete FunctionGroupBase from Pepper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « ppapi/thunk/enter.h ('k') | ppapi/thunk/ppb_audio_config_thunk.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/thunk/enter.h" 5 #include "ppapi/thunk/enter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 MessageLoop::current()->PostTask(FROM_HERE, RunWhileLocked(base::Bind( 60 MessageLoop::current()->PostTask(FROM_HERE, RunWhileLocked(base::Bind(
61 callback_.func, callback_.user_data, result))); 61 callback_.func, callback_.user_data, result)));
62 62
63 // Now that the callback will be issued in the future, we should return 63 // Now that the callback will be issued in the future, we should return
64 // "pending" to the caller, and not issue the callback again. 64 // "pending" to the caller, and not issue the callback again.
65 callback_ = PP_BlockUntilComplete(); 65 callback_ = PP_BlockUntilComplete();
66 retval_ = PP_OK_COMPLETIONPENDING; 66 retval_ = PP_OK_COMPLETIONPENDING;
67 return retval_; 67 return retval_;
68 } 68 }
69 69
70 FunctionGroupBase* EnterBase::GetFunctions(PP_Instance instance,
71 ApiID id) const {
72 return PpapiGlobals::Get()->GetFunctionAPI(instance, id);
73 }
74
75 Resource* EnterBase::GetResource(PP_Resource resource) const { 70 Resource* EnterBase::GetResource(PP_Resource resource) const {
76 return PpapiGlobals::Get()->GetResourceTracker()->GetResource(resource); 71 return PpapiGlobals::Get()->GetResourceTracker()->GetResource(resource);
77 } 72 }
78 73
79 void EnterBase::SetStateForResourceError(PP_Resource pp_resource, 74 void EnterBase::SetStateForResourceError(PP_Resource pp_resource,
80 Resource* resource_base, 75 Resource* resource_base,
81 void* object, 76 void* object,
82 bool report_error) { 77 bool report_error) {
83 if (object) 78 if (object)
84 return; // Everything worked. 79 return; // Everything worked.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 message = base::StringPrintf( 132 message = base::StringPrintf(
138 "0x%X is not a valid instance ID.", 133 "0x%X is not a valid instance ID.",
139 pp_instance); 134 pp_instance);
140 PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR, 135 PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
141 std::string(), message); 136 std::string(), message);
142 } 137 }
143 } 138 }
144 139
145 } // namespace subtle 140 } // namespace subtle
146 141
147 EnterResourceCreation::EnterResourceCreation(PP_Instance instance)
148 : EnterFunction<ResourceCreationAPI>(instance, true) {
149 }
150
151 EnterResourceCreation::~EnterResourceCreation() {
152 }
153
154 EnterInstance::EnterInstance(PP_Instance instance) 142 EnterInstance::EnterInstance(PP_Instance instance)
155 : EnterFunction<PPB_Instance_FunctionAPI>(instance, true) { 143 : EnterBase(),
144 functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) {
145 SetStateForFunctionError(instance, functions_, true);
156 } 146 }
157 147
158 EnterInstance::EnterInstance(PP_Instance instance, 148 EnterInstance::EnterInstance(PP_Instance instance,
159 const PP_CompletionCallback& callback) 149 const PP_CompletionCallback& callback)
160 : EnterFunction<PPB_Instance_FunctionAPI>(instance, callback, true) { 150 : EnterBase(callback),
151 functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) {
152 SetStateForFunctionError(instance, functions_, true);
161 } 153 }
162 154
163 EnterInstance::~EnterInstance() { 155 EnterInstance::~EnterInstance() {
164 } 156 }
165 157
166 EnterInstanceNoLock::EnterInstanceNoLock(PP_Instance instance) 158 EnterInstanceNoLock::EnterInstanceNoLock(PP_Instance instance)
167 : EnterFunctionNoLock<PPB_Instance_FunctionAPI>(instance, true) { 159 : EnterBase(),
160 functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) {
161 SetStateForFunctionError(instance, functions_, true);
168 } 162 }
169 163
170 EnterInstanceNoLock::~EnterInstanceNoLock() { 164 EnterInstanceNoLock::~EnterInstanceNoLock() {
171 } 165 }
172 166
167 EnterResourceCreation::EnterResourceCreation(PP_Instance instance)
168 : EnterBase(),
169 functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) {
170 SetStateForFunctionError(instance, functions_, true);
171 }
172
173 EnterResourceCreation::~EnterResourceCreation() {
174 }
175
176 EnterResourceCreationNoLock::EnterResourceCreationNoLock(PP_Instance instance)
177 : EnterBase(),
178 functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) {
179 SetStateForFunctionError(instance, functions_, true);
180 }
181
182 EnterResourceCreationNoLock::~EnterResourceCreationNoLock() {
183 }
184
173 } // namespace thunk 185 } // namespace thunk
174 } // namespace ppapi 186 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/enter.h ('k') | ppapi/thunk/ppb_audio_config_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698