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

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

Issue 10909244: PPAPI: Get TrackedCallback ready for running on non-main threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged. Created 8 years, 1 month 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) 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/ppb_video_capture_shared.h" 5 #include "ppapi/shared_impl/ppb_video_capture_shared.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/shared_impl/ppb_device_ref_shared.h" 9 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
10 #include "ppapi/shared_impl/ppb_resource_array_shared.h" 10 #include "ppapi/shared_impl/ppb_resource_array_shared.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 int32_t result, 117 int32_t result,
118 const std::vector<DeviceRefData>& devices) { 118 const std::vector<DeviceRefData>& devices) {
119 DCHECK(TrackedCallback::IsPending(enumerate_devices_callback_)); 119 DCHECK(TrackedCallback::IsPending(enumerate_devices_callback_));
120 120
121 if (result == PP_OK && devices_) { 121 if (result == PP_OK && devices_) {
122 *devices_ = PPB_DeviceRef_Shared::CreateResourceArray( 122 *devices_ = PPB_DeviceRef_Shared::CreateResourceArray(
123 resource_object_type_, pp_instance(), devices); 123 resource_object_type_, pp_instance(), devices);
124 } 124 }
125 devices_ = NULL; 125 devices_ = NULL;
126 126
127 TrackedCallback::ClearAndRun(&enumerate_devices_callback_, result); 127 enumerate_devices_callback_->Run(result);
128 } 128 }
129 129
130 void PPB_VideoCapture_Shared::OnOpenComplete(int32_t result) { 130 void PPB_VideoCapture_Shared::OnOpenComplete(int32_t result) {
131 if (open_state_ == BEFORE_OPEN && result == PP_OK) 131 if (open_state_ == BEFORE_OPEN && result == PP_OK)
132 open_state_ = OPENED; 132 open_state_ = OPENED;
133 133
134 // The callback may have been aborted by Close(), or the open operation is 134 // The callback may have been aborted by Close(), or the open operation is
135 // completed synchronously. 135 // completed synchronously.
136 if (TrackedCallback::IsPending(open_callback_)) 136 if (TrackedCallback::IsPending(open_callback_))
137 TrackedCallback::ClearAndRun(&open_callback_, result); 137 open_callback_->Run(result);
138 } 138 }
139 139
140 bool PPB_VideoCapture_Shared::SetStatus(PP_VideoCaptureStatus_Dev status, 140 bool PPB_VideoCapture_Shared::SetStatus(PP_VideoCaptureStatus_Dev status,
141 bool forced) { 141 bool forced) {
142 if (!forced) { 142 if (!forced) {
143 switch (status) { 143 switch (status) {
144 case PP_VIDEO_CAPTURE_STATUS_STOPPED: 144 case PP_VIDEO_CAPTURE_STATUS_STOPPED:
145 if (status_ != PP_VIDEO_CAPTURE_STATUS_STOPPING) 145 if (status_ != PP_VIDEO_CAPTURE_STATUS_STOPPING)
146 return false; 146 return false;
147 break; 147 break;
(...skipping 30 matching lines...) Expand all
178 } 178 }
179 break; 179 break;
180 } 180 }
181 } 181 }
182 182
183 status_ = status; 183 status_ = status;
184 return true; 184 return true;
185 } 185 }
186 186
187 } // namespace ppapi 187 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_graphics_3d_shared.cc ('k') | ppapi/shared_impl/ppb_video_decoder_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698