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

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: introudce ServiceWorkerContext::AddExcludedHeaderNameForFetchEvent 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 =
17 LAZY_INSTANCE_INITIALIZER;
18 }
19
20 void ServiceWorkerContext::AddExcludedHeaderNameForFetchEvent(
21 const std::string& header_name) {
22 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
23 BrowserThread::PostTask(
24 BrowserThread::IO,
25 FROM_HERE,
26 base::Bind(ServiceWorkerContext::AddExcludedHeaderNameForFetchEvent,
27 header_name));
28 return;
29 }
30 DCHECK_CURRENTLY_ON(BrowserThread::IO);
31 g_excluded_header_name_set.Get().insert(header_name);
32 }
33
34 bool ServiceWorkerContext::IsExcludedHeaderNameForFetchEvent(
35 const std::string& header_name) {
36 DCHECK_CURRENTLY_ON(BrowserThread::IO);
37 return g_excluded_header_name_set.Get().find(header_name) !=
38 g_excluded_header_name_set.Get().end();
39 }
40
41 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698