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

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

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

Powered by Google App Engine
This is Rietveld 408576698