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

Unified Diff: ppapi/examples/video_capture/video_capture.cc

Issue 9965080: Change the cpp wrappers of audio input/video capture to use CompletionCallbackWithOutput. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More changes in response to Brett's comments. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/examples/audio_input/audio_input.cc ('k') | ppapi/utility/completion_callback_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/examples/video_capture/video_capture.cc
diff --git a/ppapi/examples/video_capture/video_capture.cc b/ppapi/examples/video_capture/video_capture.cc
index 20c0c7542025c008212e9c49f00ffa42a5641802..07239c66780592cfb412d94490cb9b47c7c73475 100644
--- a/ppapi/examples/video_capture/video_capture.cc
+++ b/ppapi/examples/video_capture/video_capture.cc
@@ -118,7 +118,8 @@ class VCDemoInstance : public pp::Instance,
void CreateYUVTextures();
void Open(const pp::DeviceRef_Dev& device);
- void EnumerateDevicesFinished(int32_t result);
+ void EnumerateDevicesFinished(int32_t result,
+ std::vector<pp::DeviceRef_Dev>& devices);
void OpenFinished(int32_t result);
pp::Size position_size_;
@@ -185,9 +186,10 @@ void VCDemoInstance::HandleMessage(const pp::Var& message_data) {
if (message_data.is_string()) {
std::string event = message_data.AsString();
if (event == "PageInitialized") {
- pp::CompletionCallback callback = callback_factory_.NewCallback(
- &VCDemoInstance::EnumerateDevicesFinished);
- video_capture_.EnumerateDevices(&devices_, callback);
+ pp::CompletionCallbackWithOutput<std::vector<pp::DeviceRef_Dev> >
+ callback = callback_factory_.NewCallbackWithOutput(
+ &VCDemoInstance::EnumerateDevicesFinished);
+ video_capture_.EnumerateDevices(callback);
} else if (event == "UseDefault") {
Open(pp::DeviceRef_Dev());
} else if (event == "UseDefault(v0.1)") {
@@ -403,10 +405,13 @@ void VCDemoInstance::Open(const pp::DeviceRef_Dev& device) {
video_capture_.Open(device, capture_info_, 4, callback);
}
-void VCDemoInstance::EnumerateDevicesFinished(int32_t result) {
+void VCDemoInstance::EnumerateDevicesFinished(
+ int32_t result,
+ std::vector<pp::DeviceRef_Dev>& devices) {
static const char* const kDelimiter = "#__#";
if (result == PP_OK) {
+ devices_.swap(devices);
std::string device_names;
for (size_t index = 0; index < devices_.size(); ++index) {
pp::Var name = devices_[index].GetName();
« no previous file with comments | « ppapi/examples/audio_input/audio_input.cc ('k') | ppapi/utility/completion_callback_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698