OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_targets_ui.h" | 5 #include "chrome/browser/devtools/devtools_targets_ui.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 void StartOnIOThread() { | 126 void StartOnIOThread() { |
127 content::WorkerService::GetInstance()->AddObserver(this); | 127 content::WorkerService::GetInstance()->AddObserver(this); |
128 } | 128 } |
129 | 129 |
130 void StopOnIOThread() { | 130 void StopOnIOThread() { |
131 content::WorkerService::GetInstance()->RemoveObserver(this); | 131 content::WorkerService::GetInstance()->RemoveObserver(this); |
132 } | 132 } |
133 | 133 |
134 void NotifyOnIOThread() { | 134 void NotifyOnIOThread() { |
135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 135 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
136 BrowserThread::PostTask( | 136 BrowserThread::PostTask( |
137 BrowserThread::UI, FROM_HERE, | 137 BrowserThread::UI, FROM_HERE, |
138 base::Bind(&WorkerObserver::NotifyOnUIThread, this)); | 138 base::Bind(&WorkerObserver::NotifyOnUIThread, this)); |
139 } | 139 } |
140 | 140 |
141 void NotifyOnUIThread() { | 141 void NotifyOnUIThread() { |
142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 142 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
143 if (callback_.is_null()) | 143 if (callback_.is_null()) |
144 return; | 144 return; |
145 callback_.Run(); | 145 callback_.Run(); |
146 } | 146 } |
147 | 147 |
148 // Accessed on UI thread. | 148 // Accessed on UI thread. |
149 base::Closure callback_; | 149 base::Closure callback_; |
150 }; | 150 }; |
151 | 151 |
152 // LocalTargetsUIHandler --------------------------------------------- | 152 // LocalTargetsUIHandler --------------------------------------------- |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 device_status_dict->SetString(kPortForwardingBrowserId, | 509 device_status_dict->SetString(kPortForwardingBrowserId, |
510 sit->first->GetId()); | 510 sit->first->GetId()); |
511 | 511 |
512 std::string device_id = base::StringPrintf( | 512 std::string device_id = base::StringPrintf( |
513 kAdbDeviceIdFormat, | 513 kAdbDeviceIdFormat, |
514 sit->first->serial().c_str()); | 514 sit->first->serial().c_str()); |
515 result.Set(device_id, device_status_dict); | 515 result.Set(device_id, device_status_dict); |
516 } | 516 } |
517 callback_.Run(result); | 517 callback_.Run(result); |
518 } | 518 } |
OLD | NEW |