Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: content/browser/debugger/worker_devtools_manager.cc

Issue 8483003: Callback API Change: Reimplement Bind(); support IgnoreResult, full currying, and use less types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/cancelable_request.h ('k') | content/browser/plugin_service_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/debugger/worker_devtools_manager.h" 5 #include "content/browser/debugger/worker_devtools_manager.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 agent); 198 agent);
199 worker_id_to_cookie_.erase(it); 199 worker_id_to_cookie_.erase(it);
200 if (worker_id_to_cookie_.empty()) 200 if (worker_id_to_cookie_.empty())
201 delete this; 201 delete this;
202 return true; 202 return true;
203 } 203 }
204 204
205 static void RemovePendingWorkerData(WorkerId id) { 205 static void RemovePendingWorkerData(WorkerId id) {
206 BrowserThread::PostTask( 206 BrowserThread::PostTask(
207 BrowserThread::IO, FROM_HERE, 207 BrowserThread::IO, FROM_HERE,
208 base::Bind(RemoveInspectedWorkerDataOnIOThread, id)); 208 base::Bind(&RemoveInspectedWorkerDataOnIOThread, id));
209 } 209 }
210 210
211 static void RemoveInspectedWorkerDataOnIOThread(WorkerId id) { 211 static void RemoveInspectedWorkerDataOnIOThread(WorkerId id) {
212 WorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData(id); 212 WorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData(id);
213 } 213 }
214 214
215 static DetachedClientHosts* instance_; 215 static DetachedClientHosts* instance_;
216 typedef std::map<WorkerId, int> WorkerIdToCookieMap; 216 typedef std::map<WorkerId, int> WorkerIdToCookieMap;
217 WorkerIdToCookieMap worker_id_to_cookie_; 217 WorkerIdToCookieMap worker_id_to_cookie_;
218 }; 218 };
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return; 296 return;
297 297
298 WorkerId worker_id(worker->id(), worker_route_id); 298 WorkerId worker_id(worker->id(), worker_route_id);
299 terminated_workers_.push_back(TerminatedInspectedWorker( 299 terminated_workers_.push_back(TerminatedInspectedWorker(
300 worker_id, 300 worker_id,
301 it->worker_url, 301 it->worker_url,
302 it->worker_name)); 302 it->worker_name));
303 inspected_workers_.erase(it); 303 inspected_workers_.erase(it);
304 BrowserThread::PostTask( 304 BrowserThread::PostTask(
305 BrowserThread::UI, FROM_HERE, 305 BrowserThread::UI, FROM_HERE,
306 base::Bind(DetachedClientHosts::WorkerDestroyed, worker_id)); 306 base::Bind(&DetachedClientHosts::WorkerDestroyed, worker_id));
307 } 307 }
308 308
309 void WorkerDevToolsManager::WorkerContextStarted(WorkerProcessHost* process, 309 void WorkerDevToolsManager::WorkerContextStarted(WorkerProcessHost* process,
310 int worker_route_id) { 310 int worker_route_id) {
311 WorkerId new_worker_id(process->id(), worker_route_id); 311 WorkerId new_worker_id(process->id(), worker_route_id);
312 PausedWorkers::iterator it = paused_workers_.find(new_worker_id); 312 PausedWorkers::iterator it = paused_workers_.find(new_worker_id);
313 if (it == paused_workers_.end()) 313 if (it == paused_workers_.end())
314 return; 314 return;
315 315
316 BrowserThread::PostTask( 316 BrowserThread::PostTask(
317 BrowserThread::UI, FROM_HERE, 317 BrowserThread::UI, FROM_HERE,
318 base::Bind( 318 base::Bind(
319 DetachedClientHosts::WorkerReloaded, 319 &DetachedClientHosts::WorkerReloaded,
320 it->second, 320 it->second,
321 new_worker_id)); 321 new_worker_id));
322 paused_workers_.erase(it); 322 paused_workers_.erase(it);
323 } 323 }
324 324
325 void WorkerDevToolsManager::RemoveInspectedWorkerData( 325 void WorkerDevToolsManager::RemoveInspectedWorkerData(
326 const WorkerId& id) { 326 const WorkerId& id) {
327 for (TerminatedInspectedWorkers::iterator it = terminated_workers_.begin(); 327 for (TerminatedInspectedWorkers::iterator it = terminated_workers_.begin();
328 it != terminated_workers_.end(); ++it) { 328 it != terminated_workers_.end(); ++it) {
329 if (it->old_worker_id == id) { 329 if (it->old_worker_id == id) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 int worker_route_id, 387 int worker_route_id,
388 const IPC::Message& message) { 388 const IPC::Message& message) {
389 if (FindInspectedWorker(worker_process_id, worker_route_id) == 389 if (FindInspectedWorker(worker_process_id, worker_route_id) ==
390 inspected_workers_.end()) { 390 inspected_workers_.end()) {
391 NOTREACHED(); 391 NOTREACHED();
392 return; 392 return;
393 } 393 }
394 BrowserThread::PostTask( 394 BrowserThread::PostTask(
395 BrowserThread::UI, FROM_HERE, 395 BrowserThread::UI, FROM_HERE,
396 base::Bind( 396 base::Bind(
397 ForwardToDevToolsClientOnUIThread, 397 &ForwardToDevToolsClientOnUIThread,
398 worker_process_id, 398 worker_process_id,
399 worker_route_id, 399 worker_route_id,
400 message)); 400 message));
401 } 401 }
402 402
403 void WorkerDevToolsManager::SaveAgentRuntimeState(int worker_process_id, 403 void WorkerDevToolsManager::SaveAgentRuntimeState(int worker_process_id,
404 int worker_route_id, 404 int worker_route_id,
405 const std::string& state) { 405 const std::string& state) {
406 BrowserThread::PostTask( 406 BrowserThread::PostTask(
407 BrowserThread::UI, FROM_HERE, 407 BrowserThread::UI, FROM_HERE,
408 base::Bind( 408 base::Bind(
409 SaveAgentRuntimeStateOnUIThread, 409 &SaveAgentRuntimeStateOnUIThread,
410 worker_process_id, 410 worker_process_id,
411 worker_route_id, 411 worker_route_id,
412 state)); 412 state));
413 } 413 }
414 414
415 void WorkerDevToolsManager::ForwardToWorkerDevToolsAgent( 415 void WorkerDevToolsManager::ForwardToWorkerDevToolsAgent(
416 int worker_process_id, 416 int worker_process_id,
417 int worker_route_id, 417 int worker_route_id,
418 const IPC::Message& message) { 418 const IPC::Message& message) {
419 InspectedWorkersList::iterator it = FindInspectedWorker( 419 InspectedWorkersList::iterator it = FindInspectedWorker(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 AgentHosts::GetAgentHost(WorkerId(worker_process_id, worker_route_id)); 472 AgentHosts::GetAgentHost(WorkerId(worker_process_id, worker_route_id));
473 if (host) 473 if (host)
474 host->WorkerDestroyed(); 474 host->WorkerDestroyed();
475 } 475 }
476 476
477 // static 477 // static
478 void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) { 478 void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) {
479 if (WorkerProcessHost* process = FindWorkerProcess(id.first)) 479 if (WorkerProcessHost* process = FindWorkerProcess(id.first))
480 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); 480 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second));
481 } 481 }
482
OLDNEW
« no previous file with comments | « content/browser/cancelable_request.h ('k') | content/browser/plugin_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698