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

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

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 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 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 "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/single_thread_task_runner.h"
10 #include "base/stl_util.h" 12 #include "base/stl_util.h"
11 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
12 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h" 16 #include "base/time/time.h"
14 #include "content/browser/bad_message.h" 17 #include "content/browser/bad_message.h"
15 #include "content/browser/child_process_security_policy_impl.h" 18 #include "content/browser/child_process_security_policy_impl.h"
16 #include "content/browser/message_port_message_filter.h" 19 #include "content/browser/message_port_message_filter.h"
17 #include "content/browser/message_port_service.h" 20 #include "content/browser/message_port_service.h"
18 #include "content/browser/service_worker/embedded_worker_instance.h" 21 #include "content/browser/service_worker/embedded_worker_instance.h"
19 #include "content/browser/service_worker/embedded_worker_registry.h" 22 #include "content/browser/service_worker/embedded_worker_registry.h"
20 #include "content/browser/service_worker/service_worker_context_core.h" 23 #include "content/browser/service_worker/service_worker_context_core.h"
21 #include "content/browser/service_worker/service_worker_context_wrapper.h" 24 #include "content/browser/service_worker/service_worker_context_wrapper.h"
22 #include "content/browser/service_worker/service_worker_metrics.h" 25 #include "content/browser/service_worker/service_worker_metrics.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 const int kDestructedStartingWorkerTimeoutThresholdSeconds = 5; 68 const int kDestructedStartingWorkerTimeoutThresholdSeconds = 5;
66 69
67 const char kClaimClientsStateErrorMesage[] = 70 const char kClaimClientsStateErrorMesage[] =
68 "Only the active worker can claim clients."; 71 "Only the active worker can claim clients.";
69 72
70 const char kClaimClientsShutdownErrorMesage[] = 73 const char kClaimClientsShutdownErrorMesage[] =
71 "Failed to claim clients due to Service Worker system shutdown."; 74 "Failed to claim clients due to Service Worker system shutdown.";
72 75
73 void RunSoon(const base::Closure& callback) { 76 void RunSoon(const base::Closure& callback) {
74 if (!callback.is_null()) 77 if (!callback.is_null())
75 base::MessageLoop::current()->PostTask(FROM_HERE, callback); 78 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
76 } 79 }
77 80
78 template <typename CallbackArray, typename Arg> 81 template <typename CallbackArray, typename Arg>
79 void RunCallbacks(ServiceWorkerVersion* version, 82 void RunCallbacks(ServiceWorkerVersion* version,
80 CallbackArray* callbacks_ptr, 83 CallbackArray* callbacks_ptr,
81 const Arg& arg) { 84 const Arg& arg) {
82 CallbackArray callbacks; 85 CallbackArray callbacks;
83 callbacks.swap(*callbacks_ptr); 86 callbacks.swap(*callbacks_ptr);
84 scoped_refptr<ServiceWorkerVersion> protect(version); 87 scoped_refptr<ServiceWorkerVersion> protect(version);
85 for (const auto& callback : callbacks) 88 for (const auto& callback : callbacks)
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 return SERVICE_WORKER_ERROR_ABORT; 2033 return SERVICE_WORKER_ERROR_ABORT;
2031 default: 2034 default:
2032 return SERVICE_WORKER_ERROR_NETWORK; 2035 return SERVICE_WORKER_ERROR_NETWORK;
2033 } 2036 }
2034 } 2037 }
2035 2038
2036 return default_code; 2039 return default_code;
2037 } 2040 }
2038 2041
2039 } // namespace content 2042 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698