Chromium Code Reviews| 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 | 4 |
| 5 package org.chromium.android_webview.crash; | 5 package org.chromium.android_webview.crash; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.app.Service; | 8 import android.app.Service; |
| 9 import android.app.job.JobInfo; | 9 import android.app.job.JobInfo; |
| 10 import android.app.job.JobScheduler; | 10 import android.app.job.JobScheduler; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 mIsCopying = true; | 102 mIsCopying = true; |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 private void scheduleNewJob() { | 107 private void scheduleNewJob() { |
| 108 JobScheduler jobScheduler = (JobScheduler) getSystemService(Context.JOB_ SCHEDULER_SERVICE); | 108 JobScheduler jobScheduler = (JobScheduler) getSystemService(Context.JOB_ SCHEDULER_SERVICE); |
| 109 JobInfo newJob = new JobInfo | 109 JobInfo newJob = new JobInfo |
| 110 .Builder(MINIDUMP_UPLOADING_JOB_ID /* jobId */, | 110 .Builder(MINIDUMP_UPLOADING_JOB_ID /* jobId */, |
|
Tobias Sargeant
2017/02/28 22:30:11
nit: could you please minimise whitespace changes
Ilya Sherman
2017/02/28 23:50:53
This is "git cl format" output, unfortunately.
| |
| 111 new ComponentName(this, MinidumpUploadJobService.class)) | 111 new ComponentName(this, AwMinidumpUploa dJobService.class)) |
| 112 .setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED) | 112 .setRequiredNetworkType(JobInfo.NETWORK_TYPE_UN METERED) |
| 113 // Minimum delay when a job is retried (a retry will happen when there are minidumps | 113 // Minimum delay when a job is retried (a retry will happen when |
| 114 // left after trying to upload all minidumps - this could e.g. h appen if we add more | 114 // there are minidumps left after trying to upl oad all minidumps - |
| 115 // minidumps at the same time as uploading old ones). | 115 // this could e.g. happen if we add more minidu mps at the same time |
| 116 .setBackoffCriteria(JOB_BACKOFF_TIME_IN_MS, JOB_BACKOFF_POLICY) | 116 // as uploading old ones). |
| 117 .build(); | 117 .setBackoffCriteria(JOB_BACKOFF_TIME_IN_MS, JOB _BACKOFF_POLICY) |
| 118 .build(); | |
| 118 if (jobScheduler.schedule(newJob) == JobScheduler.RESULT_FAILURE) { | 119 if (jobScheduler.schedule(newJob) == JobScheduler.RESULT_FAILURE) { |
| 119 throw new RuntimeException("couldn't schedule " + newJob); | 120 throw new RuntimeException("couldn't schedule " + newJob); |
| 120 } | 121 } |
| 121 } | 122 } |
| 122 | 123 |
| 123 /** | 124 /** |
| 124 * Copy minidumps from the {@param fileDescriptors} to the directory where W ebView stores its | 125 * Copy minidumps from the {@param fileDescriptors} to the directory where W ebView stores its |
| 125 * minidump files. {@param context} is used to look up the directory in whic h the files will be | 126 * minidump files. {@param context} is used to look up the directory in whic h the files will be |
| 126 * saved. | 127 * saved. |
| 127 * @return whether any minidump was copied. | 128 * @return whether any minidump was copied. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 @VisibleForTesting | 211 @VisibleForTesting |
| 211 public static File getWebViewTmpCrashDir(Context context) { | 212 public static File getWebViewTmpCrashDir(Context context) { |
| 212 return new File(context.getCacheDir(), WEBVIEW_TMP_CRASH_DIR); | 213 return new File(context.getCacheDir(), WEBVIEW_TMP_CRASH_DIR); |
| 213 } | 214 } |
| 214 | 215 |
| 215 @Override | 216 @Override |
| 216 public IBinder onBind(Intent intent) { | 217 public IBinder onBind(Intent intent) { |
| 217 return mBinder; | 218 return mBinder; |
| 218 } | 219 } |
| 219 } | 220 } |
| OLD | NEW |