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

Side by Side Diff: content/browser/service_worker/service_worker_internals_ui.cc

Issue 2654993006: Show service worker navigation preload requests in DevTools Network tab. (Closed)
Patch Set: incorporated pfeldman's comment Created 3 years, 10 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/service_worker/service_worker_internals_ui.h" 5 #include "content/browser/service_worker/service_worker_internals_ui.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "content/browser/devtools/devtools_agent_host_impl.h" 18 #include "content/browser/devtools/devtools_agent_host_impl.h"
19 #include "content/browser/devtools/service_worker_devtools_agent_host.h"
19 #include "content/browser/devtools/service_worker_devtools_manager.h" 20 #include "content/browser/devtools/service_worker_devtools_manager.h"
20 #include "content/browser/service_worker/embedded_worker_status.h" 21 #include "content/browser/service_worker/embedded_worker_status.h"
21 #include "content/browser/service_worker/service_worker_context_observer.h" 22 #include "content/browser/service_worker/service_worker_context_observer.h"
22 #include "content/browser/service_worker/service_worker_context_wrapper.h" 23 #include "content/browser/service_worker/service_worker_context_wrapper.h"
23 #include "content/browser/service_worker/service_worker_registration.h" 24 #include "content/browser/service_worker/service_worker_registration.h"
24 #include "content/browser/service_worker/service_worker_version.h" 25 #include "content/browser/service_worker/service_worker_version.h"
25 #include "content/grit/content_resources.h" 26 #include "content/grit/content_resources.h"
26 #include "content/public/browser/browser_context.h" 27 #include "content/public/browser/browser_context.h"
27 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/render_process_host.h" 29 #include "content/public/browser/render_process_host.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 int devtools_agent_route_id = 0; 541 int devtools_agent_route_id = 0;
541 if (!args->GetInteger(0, &callback_id) || 542 if (!args->GetInteger(0, &callback_id) ||
542 !args->GetDictionary(1, &cmd_args) || 543 !args->GetDictionary(1, &cmd_args) ||
543 !cmd_args->GetInteger("process_host_id", &process_host_id) || 544 !cmd_args->GetInteger("process_host_id", &process_host_id) ||
544 !cmd_args->GetInteger("devtools_agent_route_id", 545 !cmd_args->GetInteger("devtools_agent_route_id",
545 &devtools_agent_route_id)) { 546 &devtools_agent_route_id)) {
546 return; 547 return;
547 } 548 }
548 base::Callback<void(ServiceWorkerStatusCode)> callback = 549 base::Callback<void(ServiceWorkerStatusCode)> callback =
549 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); 550 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id);
550 scoped_refptr<DevToolsAgentHostImpl> agent_host( 551 scoped_refptr<ServiceWorkerDevToolsAgentHost> agent_host(
551 ServiceWorkerDevToolsManager::GetInstance() 552 ServiceWorkerDevToolsManager::GetInstance()
552 ->GetDevToolsAgentHostForWorker(process_host_id, 553 ->GetDevToolsAgentHostForWorker(process_host_id,
553 devtools_agent_route_id)); 554 devtools_agent_route_id));
554 if (!agent_host.get()) { 555 if (!agent_host.get()) {
555 callback.Run(SERVICE_WORKER_ERROR_NOT_FOUND); 556 callback.Run(SERVICE_WORKER_ERROR_NOT_FOUND);
556 return; 557 return;
557 } 558 }
558 agent_host->Inspect(); 559 agent_host->Inspect();
559 callback.Run(SERVICE_WORKER_OK); 560 callback.Run(SERVICE_WORKER_OK);
560 } 561 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 callback.Run(SERVICE_WORKER_ERROR_ABORT); 615 callback.Run(SERVICE_WORKER_ERROR_ABORT);
615 return; 616 return;
616 } 617 }
617 618
618 // ServiceWorkerContextWrapper::UnregisterServiceWorker doesn't work here 619 // ServiceWorkerContextWrapper::UnregisterServiceWorker doesn't work here
619 // because that reduces a status code to boolean. 620 // because that reduces a status code to boolean.
620 context->context()->UnregisterServiceWorker(scope, callback); 621 context->context()->UnregisterServiceWorker(scope, callback);
621 } 622 }
622 623
623 } // namespace content 624 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698