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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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
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 "content/renderer/pepper/pepper_device_enumeration_host_helper.h" 5 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.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/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 bool requested() const { return requested_; } 65 bool requested() const { return requested_; }
66 66
67 private: 67 private:
68 void EnumerateDevicesCallbackBody( 68 void EnumerateDevicesCallbackBody(
69 int request_id, 69 int request_id,
70 bool succeeded, 70 bool succeeded,
71 const std::vector<ppapi::DeviceRefData>& devices) { 71 const std::vector<ppapi::DeviceRefData>& devices) {
72 if (sync_call_) { 72 if (sync_call_) {
73 MessageLoop::current()->PostTask( 73 base::MessageLoop::current()->PostTask(
74 FROM_HERE, 74 FROM_HERE,
75 base::Bind(&ScopedRequest::EnumerateDevicesCallbackBody, AsWeakPtr(), 75 base::Bind(&ScopedRequest::EnumerateDevicesCallbackBody,
76 request_id, succeeded, devices)); 76 AsWeakPtr(),
77 request_id,
78 succeeded,
79 devices));
77 } else { 80 } else {
78 DCHECK_EQ(request_id_, request_id); 81 DCHECK_EQ(request_id_, request_id);
79 callback_.Run(request_id, succeeded, devices); 82 callback_.Run(request_id, succeeded, devices);
80 // This object may have been destroyed at this point. 83 // This object may have been destroyed at this point.
81 } 84 }
82 } 85 }
83 86
84 PepperDeviceEnumerationHostHelper* owner_; 87 PepperDeviceEnumerationHostHelper* owner_;
85 PluginDelegate::EnumerateDevicesCallback callback_; 88 PluginDelegate::EnumerateDevicesCallback callback_;
86 bool requested_; 89 bool requested_;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool succeeded, 191 bool succeeded,
189 const std::vector<ppapi::DeviceRefData>& devices) { 192 const std::vector<ppapi::DeviceRefData>& devices) {
190 resource_host_->host()->SendUnsolicitedReply( 193 resource_host_->host()->SendUnsolicitedReply(
191 resource_host_->pp_resource(), 194 resource_host_->pp_resource(),
192 PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( 195 PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
193 callback_id, 196 callback_id,
194 succeeded ? devices : std::vector<ppapi::DeviceRefData>())); 197 succeeded ? devices : std::vector<ppapi::DeviceRefData>()));
195 } 198 }
196 199
197 } // namespace content 200 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_broker_impl_unittest.cc ('k') | content/renderer/pepper/pepper_graphics_2d_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698