OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package org.chromium.android_webview.crash; | 4 package org.chromium.android_webview.crash; |
5 | 5 |
6 import android.annotation.TargetApi; | 6 import android.annotation.TargetApi; |
7 import android.app.job.JobParameters; | 7 import android.app.job.JobParameters; |
8 import android.app.job.JobService; | 8 import android.app.job.JobService; |
9 import android.os.Build; | 9 import android.os.Build; |
10 | 10 |
11 import org.chromium.base.ContextUtils; | 11 import org.chromium.base.ContextUtils; |
12 | 12 |
13 /** | 13 /** |
14 * Class that interacts with the Android JobScheduler to upload Minidumps at app
ropriate times. | 14 * Class that interacts with the Android JobScheduler to upload Minidumps at app
ropriate times. |
15 */ | 15 */ |
16 @TargetApi(Build.VERSION_CODES.LOLLIPOP) | 16 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
17 // OBS: This class needs to be public to be started from android.app.ActivityThr
ead. | 17 // OBS: This class needs to be public to be started from android.app.ActivityThr
ead. |
18 public class MinidumpUploadJobService extends JobService { | 18 public class MinidumpUploadJobService extends JobService { |
19 Object mRunningLock = new Object(); | 19 Object mRunningLock = new Object(); |
20 boolean mRunningJob = false; | 20 boolean mRunningJob = false; |
21 MinidumpUploader mMinidumpUploader; | 21 MinidumpUploader mMinidumpUploader; |
22 | 22 |
23 @Override | 23 @Override |
24 public void onCreate() { | 24 public void onCreate() { |
25 super.onCreate(); | 25 super.onCreate(); |
26 SynchronizedWebViewCommandLine.initOnSeparateThread(); | 26 SynchronizedWebViewCommandLine.getInstance().initOnSeparateThread(); |
27 } | 27 } |
28 | 28 |
29 @Override | 29 @Override |
30 public boolean onStartJob(JobParameters params) { | 30 public boolean onStartJob(JobParameters params) { |
31 // Ensure we can use ContextUtils later on (from minidump_uploader compo
nent). | 31 // Ensure we can use ContextUtils later on (from minidump_uploader compo
nent). |
32 ContextUtils.initApplicationContext(this.getApplicationContext()); | 32 ContextUtils.initApplicationContext(this.getApplicationContext()); |
33 | 33 |
34 // Ensure we only run one job at a time. | 34 // Ensure we only run one job at a time. |
35 synchronized (mRunningLock) { | 35 synchronized (mRunningLock) { |
36 assert !mRunningJob; | 36 assert !mRunningJob; |
(...skipping 25 matching lines...) Expand all Loading... |
62 } | 62 } |
63 }; | 63 }; |
64 } | 64 } |
65 | 65 |
66 @Override | 66 @Override |
67 public void onDestroy() { | 67 public void onDestroy() { |
68 mMinidumpUploader = null; | 68 mMinidumpUploader = null; |
69 super.onDestroy(); | 69 super.onDestroy(); |
70 } | 70 } |
71 } | 71 } |
OLD | NEW |