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

Side by Side Diff: content/public/browser/service_worker_context.cc

Issue 666973003: [ServiceWorker] Don't send the UMA related headers to the ServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use const ref Created 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/public/browser/service_worker_context.h"
6
7 #include "base/bind.h"
8 #include "base/lazy_instance.h"
9 #include "content/public/browser/browser_thread.h"
10
11 namespace content {
12
13 namespace {
14
15 typedef std::set<std::string> HeaderNameSet;
16 static base::LazyInstance<HeaderNameSet> g_excluded_header_name_set =
Lei Zhang 2014/10/29 21:47:21 you: you don't need static in an anonymous namespa
horo 2014/10/30 07:54:34 Done.
17 LAZY_INSTANCE_INITIALIZER;
18 }
19
no sievers 2014/10/29 21:19:58 Do you think the static functions could move to th
horo 2014/10/30 07:54:34 ServiceWorkerContextWrapper which is the impl clas
no sievers 2014/10/30 19:35:33 Oh I meant just literally moving the definition of
20 void ServiceWorkerContext::AddExcludedHeadersForFetchEvent(
21 const std::vector<std::string>& header_names) {
22 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
23 BrowserThread::PostTask(
no sievers 2014/10/29 21:19:58 Could you let the caller handle that? Then you can
horo 2014/10/30 07:54:34 Done.
24 BrowserThread::IO,
25 FROM_HERE,
26 base::Bind(ServiceWorkerContext::AddExcludedHeadersForFetchEvent,
27 header_names));
28 return;
29 }
30 DCHECK_CURRENTLY_ON(BrowserThread::IO);
31 g_excluded_header_name_set.Get().insert(header_names.begin(),
32 header_names.end());
33 }
34
35 bool ServiceWorkerContext::IsExcludedHeaderNameForFetchEvent(
36 const std::string& header_name) {
37 DCHECK_CURRENTLY_ON(BrowserThread::IO);
38 return g_excluded_header_name_set.Get().find(header_name) !=
39 g_excluded_header_name_set.Get().end();
40 }
41
42 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698