OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/devtools_adb_bridge.h" | 5 #include "chrome/browser/devtools/devtools_adb_bridge.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 571 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
572 if (!instance_) | 572 if (!instance_) |
573 new RefCountedAdbThread(); | 573 new RefCountedAdbThread(); |
574 return instance_; | 574 return instance_; |
575 } | 575 } |
576 | 576 |
577 DevToolsAdbBridge::RefCountedAdbThread::RefCountedAdbThread() { | 577 DevToolsAdbBridge::RefCountedAdbThread::RefCountedAdbThread() { |
578 instance_ = this; | 578 instance_ = this; |
579 thread_ = new base::Thread(kDevToolsAdbBridgeThreadName); | 579 thread_ = new base::Thread(kDevToolsAdbBridgeThreadName); |
580 base::Thread::Options options; | 580 base::Thread::Options options; |
581 options.message_loop_type = MessageLoop::TYPE_IO; | 581 options.message_loop_type = base::MessageLoop::TYPE_IO; |
582 if (!thread_->StartWithOptions(options)) { | 582 if (!thread_->StartWithOptions(options)) { |
583 delete thread_; | 583 delete thread_; |
584 thread_ = NULL; | 584 thread_ = NULL; |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 MessageLoop* DevToolsAdbBridge::RefCountedAdbThread::message_loop() { | 588 MessageLoop* DevToolsAdbBridge::RefCountedAdbThread::message_loop() { |
589 return thread_ ? thread_->message_loop() : NULL; | 589 return thread_ ? thread_->message_loop() : NULL; |
590 } | 590 } |
591 | 591 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 if (!has_message_loop_) | 647 if (!has_message_loop_) |
648 return; | 648 return; |
649 | 649 |
650 scoped_refptr<AdbAttachCommand> command( | 650 scoped_refptr<AdbAttachCommand> command( |
651 new AdbAttachCommand(weak_factory_.GetWeakPtr(), serial, socket, | 651 new AdbAttachCommand(weak_factory_.GetWeakPtr(), serial, socket, |
652 debug_url, frontend_url)); | 652 debug_url, frontend_url)); |
653 adb_thread_->message_loop()->PostTask( | 653 adb_thread_->message_loop()->PostTask( |
654 FROM_HERE, | 654 FROM_HERE, |
655 base::Bind(&AdbAttachCommand::Run, command)); | 655 base::Bind(&AdbAttachCommand::Run, command)); |
656 } | 656 } |
OLD | NEW |