| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/devtools/device/android_device_manager.h" | 5 #include "chrome/browser/devtools/device/android_device_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 482 |
| 483 scoped_refptr<base::SingleThreadTaskRunner> | 483 scoped_refptr<base::SingleThreadTaskRunner> |
| 484 AndroidDeviceManager::HandlerThread::message_loop() { | 484 AndroidDeviceManager::HandlerThread::message_loop() { |
| 485 return thread_ ? thread_->task_runner() : NULL; | 485 return thread_ ? thread_->task_runner() : NULL; |
| 486 } | 486 } |
| 487 | 487 |
| 488 // static | 488 // static |
| 489 void AndroidDeviceManager::HandlerThread::StopThread( | 489 void AndroidDeviceManager::HandlerThread::StopThread( |
| 490 base::Thread* thread) { | 490 base::Thread* thread) { |
| 491 thread->Stop(); | 491 thread->Stop(); |
| 492 delete thread; |
| 492 } | 493 } |
| 493 | 494 |
| 494 AndroidDeviceManager::HandlerThread::~HandlerThread() { | 495 AndroidDeviceManager::HandlerThread::~HandlerThread() { |
| 495 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 496 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 496 instance_ = NULL; | 497 instance_ = NULL; |
| 497 if (!thread_) | 498 if (!thread_) |
| 498 return; | 499 return; |
| 499 // Shut down thread on FILE thread to join into IO. | 500 // Shut down thread on FILE thread to join into IO. |
| 500 content::BrowserThread::PostTask( | 501 content::BrowserThread::PostTask( |
| 501 content::BrowserThread::FILE, FROM_HERE, | 502 content::BrowserThread::FILE, FROM_HERE, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 new Device(handler_thread_->message_loop(), it->provider, it->serial); | 551 new Device(handler_thread_->message_loop(), it->provider, it->serial); |
| 551 } else { | 552 } else { |
| 552 device = found->second.get(); | 553 device = found->second.get(); |
| 553 } | 554 } |
| 554 response.push_back(device); | 555 response.push_back(device); |
| 555 new_devices[it->serial] = device->weak_factory_.GetWeakPtr(); | 556 new_devices[it->serial] = device->weak_factory_.GetWeakPtr(); |
| 556 } | 557 } |
| 557 devices_.swap(new_devices); | 558 devices_.swap(new_devices); |
| 558 callback.Run(response); | 559 callback.Run(response); |
| 559 } | 560 } |
| OLD | NEW |