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 // Implements the Chrome Extensions Debugger API. | 5 // Implements the Chrome Extensions Debugger API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" | 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 754 |
755 std::vector<RenderViewHost*> rvh_list = | 755 std::vector<RenderViewHost*> rvh_list = |
756 DevToolsAgentHost::GetValidRenderViewHosts(); | 756 DevToolsAgentHost::GetValidRenderViewHosts(); |
757 for (std::vector<RenderViewHost*>::iterator it = rvh_list.begin(); | 757 for (std::vector<RenderViewHost*>::iterator it = rvh_list.begin(); |
758 it != rvh_list.end(); ++it) { | 758 it != rvh_list.end(); ++it) { |
759 base::Value* value = SerializePageInfo(*it); | 759 base::Value* value = SerializePageInfo(*it); |
760 if (value) | 760 if (value) |
761 results_list->Append(value); | 761 results_list->Append(value); |
762 } | 762 } |
763 | 763 |
764 content::BrowserThread::PostTaskAndReply( | 764 content::BrowserThread::PostTaskAndReplyWithResult( |
765 content::BrowserThread::IO, | 765 content::BrowserThread::IO, |
766 FROM_HERE, | 766 FROM_HERE, |
767 base::Bind(&DebuggerGetTargetsFunction::CollectWorkerInfo, this, | 767 base::Bind(&DebuggerGetTargetsFunction::CollectWorkerInfo, this), |
768 results_list), | |
769 base::Bind(&DebuggerGetTargetsFunction::SendTargetList, this, | 768 base::Bind(&DebuggerGetTargetsFunction::SendTargetList, this, |
770 results_list)); | 769 results_list)); |
771 return true; | 770 return true; |
772 } | 771 } |
773 | 772 |
774 void DebuggerGetTargetsFunction::CollectWorkerInfo(base::ListValue* list) { | 773 DebuggerGetTargetsFunction::WorkerInfoList |
775 std::vector<WorkerService::WorkerInfo> worker_info = | 774 DebuggerGetTargetsFunction::CollectWorkerInfo() { |
776 WorkerService::GetInstance()->GetWorkers(); | 775 return WorkerService::GetInstance()->GetWorkers(); |
| 776 } |
| 777 |
| 778 void DebuggerGetTargetsFunction::SendTargetList( |
| 779 base::ListValue* list, |
| 780 const WorkerInfoList& worker_info) { |
777 for (size_t i = 0; i < worker_info.size(); ++i) | 781 for (size_t i = 0; i < worker_info.size(); ++i) |
778 list->Append(SerializeWorkerInfo(worker_info[i])); | 782 list->Append(SerializeWorkerInfo(worker_info[i])); |
779 } | |
780 | |
781 void DebuggerGetTargetsFunction::SendTargetList(base::ListValue* list) { | |
782 SetResult(list); | 783 SetResult(list); |
783 SendResponse(true); | 784 SendResponse(true); |
784 } | 785 } |
OLD | NEW |