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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java

Issue 2043703003: 🍆 Move GCM browser initialization to chrome layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move FB suppressant. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/PushMessagingTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java b/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java
index 64ab0f58b516e134126c3e4ab3f72b35ecaeaf74..6ed9fbd5b8a7092840ec7583114caa17073fb411 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java
@@ -5,13 +5,15 @@
package org.chromium.chrome.browser.services.gcm;
import android.os.Bundle;
-import android.util.Log;
import com.google.android.gms.gcm.GcmListenerService;
import com.google.ipc.invalidation.ticl.android2.channel.AndroidGcmController;
-import org.chromium.base.PathUtils;
+import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
+import org.chromium.base.annotations.SuppressFBWarnings;
+import org.chromium.base.library_loader.ProcessInitException;
+import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
import org.chromium.components.gcm_driver.GCMDriver;
/**
@@ -19,7 +21,6 @@ import org.chromium.components.gcm_driver.GCMDriver;
*/
public class ChromeGcmListenerService extends GcmListenerService {
private static final String TAG = "ChromeGcmListener";
- private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome";
@Override
public void onMessageReceived(String from, Bundle data) {
@@ -59,10 +60,18 @@ public class ChromeGcmListenerService extends GcmListenerService {
final String appId = data.getString(bundleSubtype);
ThreadUtils.runOnUiThread(new Runnable() {
@Override
+ @SuppressFBWarnings("DM_EXIT")
public void run() {
- PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX,
- getApplicationContext());
- GCMDriver.onMessageReceived(getApplicationContext(), appId, from, data);
+ try {
+ ChromeBrowserInitializer.getInstance(getApplicationContext())
+ .handleSynchronousStartup();
+ GCMDriver.onMessageReceived(appId, from, data);
+ } catch (ProcessInitException e) {
+ Log.e(TAG, "ProcessInitException while starting the browser process");
+ // Since the library failed to initialize nothing in the application
+ // can work, so kill the whole application not just the activity.
+ System.exit(-1);
+ }
}
});
}
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/push_messaging/PushMessagingTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698