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

Side by Side Diff: chrome/browser/android/chromium_application.cc

Issue 1095243002: [chrome/browser/android] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/android/cookies/cookies_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/android/chromium_application.h" 5 #include "chrome/browser/android/chromium_application.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/android/tab_android.h" 10 #include "chrome/browser/android/tab_android.h"
(...skipping 11 matching lines...) Expand all
22 #include "net/cookies/cookie_store.h" 22 #include "net/cookies/cookie_store.h"
23 #include "net/url_request/url_request_context.h" 23 #include "net/url_request/url_request_context.h"
24 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
25 25
26 using base::android::ConvertUTF8ToJavaString; 26 using base::android::ConvertUTF8ToJavaString;
27 27
28 namespace { 28 namespace {
29 29
30 void FlushCookiesOnIOThread( 30 void FlushCookiesOnIOThread(
31 scoped_refptr<net::URLRequestContextGetter> getter) { 31 scoped_refptr<net::URLRequestContextGetter> getter) {
32 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 32 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
33 getter->GetURLRequestContext() 33 getter->GetURLRequestContext()
34 ->cookie_store() 34 ->cookie_store()
35 ->GetCookieMonster() 35 ->GetCookieMonster()
36 ->FlushStore(base::Closure()); 36 ->FlushStore(base::Closure());
37 } 37 }
38 38
39 void CommitPendingWritesForProfile(Profile* profile) { 39 void CommitPendingWritesForProfile(Profile* profile) {
40 // These calls are asynchronous. They may not finish (and may not even 40 // These calls are asynchronous. They may not finish (and may not even
41 // start!) before the Android OS kills our process. But we can't wait for them 41 // start!) before the Android OS kills our process. But we can't wait for them
42 // to finish because blocking the UI thread is illegal. 42 // to finish because blocking the UI thread is illegal.
43 profile->GetPrefs()->CommitPendingWrite(); 43 profile->GetPrefs()->CommitPendingWrite();
44 content::BrowserThread::PostTask( 44 content::BrowserThread::PostTask(
45 content::BrowserThread::IO, FROM_HERE, 45 content::BrowserThread::IO, FROM_HERE,
46 base::Bind(&FlushCookiesOnIOThread, 46 base::Bind(&FlushCookiesOnIOThread,
47 make_scoped_refptr(profile->GetRequestContext()))); 47 make_scoped_refptr(profile->GetRequestContext())));
48 profile->GetNetworkPredictor()->SaveStateForNextStartupAndTrim(); 48 profile->GetNetworkPredictor()->SaveStateForNextStartupAndTrim();
49 } 49 }
50 50
51 void RemoveSessionCookiesOnIOThread( 51 void RemoveSessionCookiesOnIOThread(
52 scoped_refptr<net::URLRequestContextGetter> getter) { 52 scoped_refptr<net::URLRequestContextGetter> getter) {
53 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 53 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
54 getter->GetURLRequestContext()->cookie_store()->DeleteSessionCookiesAsync( 54 getter->GetURLRequestContext()->cookie_store()->DeleteSessionCookiesAsync(
55 net::CookieStore::DeleteCallback()); 55 net::CookieStore::DeleteCallback());
56 } 56 }
57 57
58 void RemoveSessionCookiesForProfile(Profile* profile) { 58 void RemoveSessionCookiesForProfile(Profile* profile) {
59 content::BrowserThread::PostTask( 59 content::BrowserThread::PostTask(
60 content::BrowserThread::IO, FROM_HERE, 60 content::BrowserThread::IO, FROM_HERE,
61 base::Bind(&RemoveSessionCookiesOnIOThread, 61 base::Bind(&RemoveSessionCookiesOnIOThread,
62 make_scoped_refptr(profile->GetRequestContext()))); 62 make_scoped_refptr(profile->GetRequestContext())));
63 } 63 }
64 64
65 void ChangeAppStatusOnIOThread(SafeBrowsingService* sb_service, 65 void ChangeAppStatusOnIOThread(SafeBrowsingService* sb_service,
66 jboolean foreground) { 66 jboolean foreground) {
67 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 67 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
68 SafeBrowsingProtocolManager* proto_manager = sb_service->protocol_manager(); 68 SafeBrowsingProtocolManager* proto_manager = sb_service->protocol_manager();
69 if (proto_manager) 69 if (proto_manager)
70 proto_manager->SetAppInForeground(foreground); 70 proto_manager->SetAppInForeground(foreground);
71 } 71 }
72 72
73 } // namespace 73 } // namespace
74 74
75 static jstring GetBrowserUserAgent(JNIEnv* env, jclass clazz) { 75 static jstring GetBrowserUserAgent(JNIEnv* env, jclass clazz) {
76 return ConvertUTF8ToJavaString(env, GetUserAgent()).Release(); 76 return ConvertUTF8ToJavaString(env, GetUserAgent()).Release();
77 } 77 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 bool ChromiumApplication::AreParentalControlsEnabled() { 141 bool ChromiumApplication::AreParentalControlsEnabled() {
142 return Java_ChromiumApplication_areParentalControlsEnabled( 142 return Java_ChromiumApplication_areParentalControlsEnabled(
143 base::android::AttachCurrentThread(), 143 base::android::AttachCurrentThread(),
144 base::android::GetApplicationContext()); 144 base::android::GetApplicationContext());
145 } 145 }
146 146
147 } // namespace android 147 } // namespace android
148 } // namespace chrome 148 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/cookies/cookies_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698