OLD | NEW |
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/browser/device_orientation/provider_impl.h" | 5 #include "content/browser/device_orientation/provider_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 Stop(); | 217 Stop(); |
218 } | 218 } |
219 | 219 |
220 void ProviderImpl::Start(DeviceData::Type type) { | 220 void ProviderImpl::Start(DeviceData::Type type) { |
221 DCHECK(MessageLoop::current() == creator_loop_); | 221 DCHECK(MessageLoop::current() == creator_loop_); |
222 DCHECK(!polling_thread_); | 222 DCHECK(!polling_thread_); |
223 | 223 |
224 polling_thread_ = new PollingThread("Device data polling thread", | 224 polling_thread_ = new PollingThread("Device data polling thread", |
225 weak_factory_.GetWeakPtr(), | 225 weak_factory_.GetWeakPtr(), |
226 creator_loop_); | 226 creator_loop_); |
| 227 #if defined(OS_WIN) |
| 228 polling_thread_->init_com_with_mta(true); |
| 229 #endif |
227 if (!polling_thread_->Start()) { | 230 if (!polling_thread_->Start()) { |
228 LOG(ERROR) << "Failed to start device data polling thread"; | 231 LOG(ERROR) << "Failed to start device data polling thread"; |
229 delete polling_thread_; | 232 delete polling_thread_; |
230 polling_thread_ = NULL; | 233 polling_thread_ = NULL; |
231 return; | 234 return; |
232 } | 235 } |
233 ScheduleInitializePollingThread(type); | 236 ScheduleInitializePollingThread(type); |
234 } | 237 } |
235 | 238 |
236 void ProviderImpl::Stop() { | 239 void ProviderImpl::Stop() { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 observers_.erase(current); | 287 observers_.erase(current); |
285 } | 288 } |
286 | 289 |
287 if (observers_.empty()) | 290 if (observers_.empty()) |
288 Stop(); | 291 Stop(); |
289 } | 292 } |
290 } | 293 } |
291 | 294 |
292 | 295 |
293 } // namespace content | 296 } // namespace content |
OLD | NEW |