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

Unified Diff: chrome/browser/crash_upload_list/crash_upload_list_android.cc

Issue 2324983002: [Android] Wire up manual crash uploads. (Closed)
Patch Set: Write tests, and show forced uploads in chrome://crashes UI Created 4 years, 3 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
Index: chrome/browser/crash_upload_list/crash_upload_list_android.cc
diff --git a/chrome/browser/crash_upload_list/crash_upload_list_android.cc b/chrome/browser/crash_upload_list/crash_upload_list_android.cc
index f360b22878ef6a26c008e3d3582fce33f38e58f4..31e70142c77c08113f0f808a800bcec6f8851e98 100644
--- a/chrome/browser/crash_upload_list/crash_upload_list_android.cc
+++ b/chrome/browser/crash_upload_list/crash_upload_list_android.cc
@@ -4,10 +4,14 @@
#include "chrome/browser/crash_upload_list/crash_upload_list_android.h"
+#include "base/android/context_utils.h"
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
#include "base/files/file.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/threading/sequenced_worker_pool.h"
+#include "jni/MinidumpUploadService_jni.h"
CrashUploadListAndroid::CrashUploadListAndroid(
Delegate* delegate,
@@ -25,17 +29,35 @@ void CrashUploadListAndroid::LoadUploadList(
LoadUnsuccessfulUploadList(uploads);
}
+void CrashUploadListAndroid::RequestSingleCrashUpload(
+ const std::string& local_id) {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ const base::android::JavaRef<jobject>& context =
+ base::android::GetApplicationContext();
+ base::android::ScopedJavaLocalRef<jstring> j_local_id =
+ base::android::ConvertUTF8ToJavaString(env, local_id);
+ Java_MinidumpUploadService_tryUploadCrashDumpWithLocalId(env, context,
+ j_local_id);
+}
+
void CrashUploadListAndroid::LoadUnsuccessfulUploadList(
std::vector<UploadInfo>* uploads) {
const char unsuccessful_uploads[] = ".dmp";
const char skipped_uploads[] = ".skipped";
+ const char manually_forced_uploads[] = ".forced";
base::FileEnumerator files(upload_log_path().DirName(), false,
base::FileEnumerator::FILES);
for (base::FilePath file = files.Next(); !file.empty(); file = files.Next()) {
- if (file.value().find(unsuccessful_uploads) == std::string::npos &&
- file.value().find(skipped_uploads) == std::string::npos)
+ bool is_forced;
+ if (file.value().find(manually_forced_uploads) != std::string::npos) {
Mark Mentovai 2016/09/15 00:02:30 base::EndsWith() from base/strings/string_util.h?
Ilya Sherman 2016/09/21 22:50:02 Acknowledged.
+ is_forced = true;
+ } else if (file.value().find(unsuccessful_uploads) != std::string::npos ||
+ file.value().find(skipped_uploads) != std::string::npos) {
+ is_forced = false;
+ } else {
continue;
Mark Mentovai 2016/09/15 00:02:29 What are these, no upload attempted yet? I guess t
Ilya Sherman 2016/09/21 22:50:02 There's various other junk in the directory, such
+ }
base::File::Info info;
if (!base::GetFileInfo(file, &info))
@@ -55,9 +77,11 @@ void CrashUploadListAndroid::LoadUnsuccessfulUploadList(
continue;
id = id.substr(pos + 1);
+ UploadList::UploadInfo::State upload_state =
+ is_forced ? UploadList::UploadInfo::State::Pending_UserRequested
+ : UploadList::UploadInfo::State::NotUploaded;
UploadList::UploadInfo upload(std::string(), base::Time(), id,
- info.creation_time,
- UploadList::UploadInfo::State::NotUploaded);
+ info.creation_time, upload_state);
uploads->push_back(upload);
}
}

Powered by Google App Engine
This is Rietveld 408576698