OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/workers_ui.h" | 5 #include "chrome/browser/ui/webui/workers_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 void WorkersUIHTMLSource::SendSharedWorkersData(int request_id) { | 86 void WorkersUIHTMLSource::SendSharedWorkersData(int request_id) { |
87 ListValue workers_list; | 87 ListValue workers_list; |
88 BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS); | 88 BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS); |
89 for (; !iter.Done(); ++iter) { | 89 for (; !iter.Done(); ++iter) { |
90 WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); | 90 WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); |
91 const WorkerProcessHost::Instances& instances = worker->instances(); | 91 const WorkerProcessHost::Instances& instances = worker->instances(); |
92 for (WorkerProcessHost::Instances::const_iterator i = instances.begin(); | 92 for (WorkerProcessHost::Instances::const_iterator i = instances.begin(); |
93 i != instances.end(); ++i) { | 93 i != instances.end(); ++i) { |
94 if (!i->shared()) | 94 workers_list.Append(BuildWorkerData(worker, *i)); |
95 continue; | |
96 workers_list.Append(BuildWorkerData(worker, *i)); | |
97 } | 95 } |
98 } | 96 } |
99 | 97 |
100 std::string json_string; | 98 std::string json_string; |
101 base::JSONWriter::Write(&workers_list, false, &json_string); | 99 base::JSONWriter::Write(&workers_list, false, &json_string); |
102 | 100 |
103 SendResponse(request_id, base::RefCountedString::TakeString(&json_string)); | 101 SendResponse(request_id, base::RefCountedString::TakeString(&json_string)); |
104 } | 102 } |
105 | 103 |
106 class WorkersDOMHandler : public WebUIMessageHandler { | 104 class WorkersDOMHandler : public WebUIMessageHandler { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 260 |
263 // Set up the chrome://workers/ source. | 261 // Set up the chrome://workers/ source. |
264 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 262 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
265 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 263 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
266 } | 264 } |
267 | 265 |
268 WorkersUI::~WorkersUI() { | 266 WorkersUI::~WorkersUI() { |
269 observer_->WorkersUIDestroyed(); | 267 observer_->WorkersUIDestroyed(); |
270 observer_ = NULL; | 268 observer_ = NULL; |
271 } | 269 } |
OLD | NEW |