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

Side by Side Diff: android_webview/browser/aw_resource_context.cc

Issue 1013843002: favor DCHECK_CURRENTLY_ON for better logs in android_webview/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change a few more Created 5 years, 9 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 "android_webview/browser/aw_resource_context.h" 5 #include "android_webview/browser/aw_resource_context.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "net/url_request/url_request_context.h" 8 #include "net/url_request/url_request_context.h"
9 #include "net/url_request/url_request_context_getter.h" 9 #include "net/url_request/url_request_context_getter.h"
10 10
11 using content::BrowserThread;
12
11 namespace android_webview { 13 namespace android_webview {
12 14
13 AwResourceContext::AwResourceContext(net::URLRequestContextGetter* getter) 15 AwResourceContext::AwResourceContext(net::URLRequestContextGetter* getter)
14 : getter_(getter) { 16 : getter_(getter) {
15 DCHECK(getter_); 17 DCHECK(getter_);
16 } 18 }
17 19
18 AwResourceContext::~AwResourceContext() { 20 AwResourceContext::~AwResourceContext() {
19 } 21 }
20 22
21 void AwResourceContext::SetExtraHeaders( 23 void AwResourceContext::SetExtraHeaders(
22 const GURL& url, const std::string& headers) { 24 const GURL& url, const std::string& headers) {
23 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 25 DCHECK_CURRENTLY_ON(BrowserThread::UI);
24 if (!url.is_valid()) return; 26 if (!url.is_valid()) return;
25 base::AutoLock scoped_lock(extra_headers_lock_); 27 base::AutoLock scoped_lock(extra_headers_lock_);
26 if (!headers.empty()) 28 if (!headers.empty())
27 extra_headers_[url.spec()] = headers; 29 extra_headers_[url.spec()] = headers;
28 else 30 else
29 extra_headers_.erase(url.spec()); 31 extra_headers_.erase(url.spec());
30 } 32 }
31 33
32 std::string AwResourceContext::GetExtraHeaders(const GURL& url) { 34 std::string AwResourceContext::GetExtraHeaders(const GURL& url) {
33 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 35 DCHECK_CURRENTLY_ON(BrowserThread::IO);
34 if (!url.is_valid()) return std::string(); 36 if (!url.is_valid()) return std::string();
35 base::AutoLock scoped_lock(extra_headers_lock_); 37 base::AutoLock scoped_lock(extra_headers_lock_);
36 std::map<std::string, std::string>::iterator iter = 38 std::map<std::string, std::string>::iterator iter =
37 extra_headers_.find(url.spec()); 39 extra_headers_.find(url.spec());
38 return iter != extra_headers_.end() ? iter->second : std::string(); 40 return iter != extra_headers_.end() ? iter->second : std::string();
39 } 41 }
40 42
41 net::HostResolver* AwResourceContext::GetHostResolver() { 43 net::HostResolver* AwResourceContext::GetHostResolver() {
42 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 44 DCHECK_CURRENTLY_ON(BrowserThread::IO);
43 return getter_->GetURLRequestContext()->host_resolver(); 45 return getter_->GetURLRequestContext()->host_resolver();
44 } 46 }
45 47
46 net::URLRequestContext* AwResourceContext::GetRequestContext() { 48 net::URLRequestContext* AwResourceContext::GetRequestContext() {
47 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 49 DCHECK_CURRENTLY_ON(BrowserThread::IO);
48 return getter_->GetURLRequestContext(); 50 return getter_->GetURLRequestContext();
49 } 51 }
50 52
51 } // namespace android_webview 53 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_request_interceptor.cc ('k') | android_webview/browser/icon_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698