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

Side by Side Diff: content/browser/android/background_sync_launcher_android.cc

Issue 1288593003: [BackgroundSync] Move read and write of shared preferences to an AsyncTask (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync as suffix instead of prefix Created 5 years, 4 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 | content/public/android/java/src/org/chromium/content/browser/BackgroundSyncLauncher.java » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/background_sync_launcher_android.h" 5 #include "content/browser/android/background_sync_launcher_android.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "jni/BackgroundSyncLauncher_jni.h" 8 #include "jni/BackgroundSyncLauncher_jni.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 28 matching lines...) Expand all
39 39
40 if (launch_when_next_online) 40 if (launch_when_next_online)
41 launch_when_next_online_registrants_.insert(registrant); 41 launch_when_next_online_registrants_.insert(registrant);
42 else 42 else
43 launch_when_next_online_registrants_.erase(registrant); 43 launch_when_next_online_registrants_.erase(registrant);
44 44
45 bool now_launching = !launch_when_next_online_registrants_.empty(); 45 bool now_launching = !launch_when_next_online_registrants_.empty();
46 if (was_launching != now_launching) { 46 if (was_launching != now_launching) {
47 JNIEnv* env = base::android::AttachCurrentThread(); 47 JNIEnv* env = base::android::AttachCurrentThread();
48 Java_BackgroundSyncLauncher_setLaunchWhenNextOnline( 48 Java_BackgroundSyncLauncher_setLaunchWhenNextOnline(
49 env, java_launcher_.obj(), now_launching); 49 env, java_launcher_.obj(), base::android::GetApplicationContext(),
50 now_launching);
50 } 51 }
51 } 52 }
52 53
53 // static 54 // static
54 bool BackgroundSyncLauncherAndroid::RegisterLauncher(JNIEnv* env) { 55 bool BackgroundSyncLauncherAndroid::RegisterLauncher(JNIEnv* env) {
55 return RegisterNativesImpl(env); 56 return RegisterNativesImpl(env);
56 } 57 }
57 58
58 BackgroundSyncLauncherAndroid::BackgroundSyncLauncherAndroid() { 59 BackgroundSyncLauncherAndroid::BackgroundSyncLauncherAndroid() {
59 DCHECK_CURRENTLY_ON(BrowserThread::UI); 60 DCHECK_CURRENTLY_ON(BrowserThread::UI);
60 61
61 JNIEnv* env = base::android::AttachCurrentThread(); 62 JNIEnv* env = base::android::AttachCurrentThread();
62 java_launcher_.Reset(Java_BackgroundSyncLauncher_create( 63 java_launcher_.Reset(Java_BackgroundSyncLauncher_create(
63 env, base::android::GetApplicationContext())); 64 env, base::android::GetApplicationContext()));
64 } 65 }
65 66
66 BackgroundSyncLauncherAndroid::~BackgroundSyncLauncherAndroid() { 67 BackgroundSyncLauncherAndroid::~BackgroundSyncLauncherAndroid() {
67 DCHECK_CURRENTLY_ON(BrowserThread::UI); 68 DCHECK_CURRENTLY_ON(BrowserThread::UI);
68 69
69 JNIEnv* env = base::android::AttachCurrentThread(); 70 JNIEnv* env = base::android::AttachCurrentThread();
70 Java_BackgroundSyncLauncher_destroy(env, java_launcher_.obj()); 71 Java_BackgroundSyncLauncher_destroy(env, java_launcher_.obj());
71 } 72 }
72 73
73 } // namespace content 74 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/BackgroundSyncLauncher.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698