diff --git a/handler/crash_report_upload_thread.cc b/handler/crash_report_upload_thread.cc index 205d860f..e144bddc 100644 --- a/handler/crash_report_upload_thread.cc +++ b/handler/crash_report_upload_thread.cc @@ -246,12 +246,6 @@ void CrashReportUploadThread::ProcessPendingReport( CrashReportUploadThread::UploadResult CrashReportUploadThread::UploadReport( const CrashReportDatabase::UploadReport* report, std::string* response_body) { -#if defined(OS_ANDROID) - // TODO(jperaza): This method can be enabled on Android after HTTPTransport is - // implemented and Crashpad takes over upload responsibilty on Android. - NOTREACHED(); - return UploadResult::kPermanentFailure; -#else std::map parameters; FileReader* reader = report->Reader(); @@ -338,7 +332,6 @@ CrashReportUploadThread::UploadResult CrashReportUploadThread::UploadReport( } return UploadResult::kSuccess; -#endif // OS_ANDROID } void CrashReportUploadThread::DoWork(const WorkerThread* thread) { diff --git a/util/BUILD.gn b/util/BUILD.gn index cfa4e225..64b74ac7 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -269,7 +269,7 @@ static_library("util") { deps = [] - if (crashpad_is_linux || crashpad_is_fuchsia) { + if (crashpad_is_linux || crashpad_is_fuchsia || crashpad_is_android) { sources += [ "net/http_transport_socket.cc" ] if (crashpad_use_boringssl_for_http_transport_socket) { defines = [ "CRASHPAD_USE_BORINGSSL" ] @@ -283,8 +283,6 @@ static_library("util") { ] } } - } else if (crashpad_is_android) { - sources += [ "net/http_transport_none.cc" ] } if (crashpad_is_linux || crashpad_is_android) { diff --git a/util/net/http_transport_none.cc b/util/net/http_transport_none.cc deleted file mode 100644 index 1c08c1f1..00000000 --- a/util/net/http_transport_none.cc +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Crashpad Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "util/net/http_transport.h" - -#include "base/logging.h" - -namespace crashpad { - -std::unique_ptr HTTPTransport::Create() { - NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196 - return std::unique_ptr(); -} - -} // namespace crashpad diff --git a/util/thread/worker_thread.cc b/util/thread/worker_thread.cc index 3cf48970..b5dcdb28 100644 --- a/util/thread/worker_thread.cc +++ b/util/thread/worker_thread.cc @@ -33,8 +33,9 @@ class WorkerThreadImpl final : public Thread { if (initial_work_delay_ > 0) semaphore_.TimedWait(initial_work_delay_); - while (self_->running_) { + while (self_->running_ || self_->do_work_now_) { self_->delegate_->DoWork(self_); + self_->do_work_now_ = false; semaphore_.TimedWait(self_->work_interval_); } } @@ -57,7 +58,8 @@ WorkerThread::WorkerThread(double work_interval, : work_interval_(work_interval), delegate_(delegate), impl_(), - running_(false) {} + running_(false), + do_work_now_(false) {} WorkerThread::~WorkerThread() { DCHECK(!running_); @@ -88,6 +90,7 @@ void WorkerThread::Stop() { void WorkerThread::DoWorkNow() { DCHECK(running_); + do_work_now_ = true; impl_->SignalSemaphore(); } diff --git a/util/thread/worker_thread.h b/util/thread/worker_thread.h index 97fb6ecd..0fae0090 100644 --- a/util/thread/worker_thread.h +++ b/util/thread/worker_thread.h @@ -92,6 +92,7 @@ class WorkerThread { Delegate* delegate_; // weak std::unique_ptr impl_; bool running_; + bool do_work_now_; DISALLOW_COPY_AND_ASSIGN(WorkerThread); }; diff --git a/util/util.gyp b/util/util.gyp index 7efec7dc..a438fa69 100644 --- a/util/util.gyp +++ b/util/util.gyp @@ -184,7 +184,6 @@ 'net/http_transport.cc', 'net/http_transport.h', 'net/http_transport_mac.mm', - 'net/http_transport_none.cc', 'net/http_transport_win.cc', 'net/url.cc', 'net/url.h', @@ -393,7 +392,7 @@ 'win/safe_terminate_process.asm', ], }], - ['OS=="linux"', { + ['OS=="linux" or OS=="android"', { 'sources': [ 'net/http_transport_socket.cc', ], @@ -402,11 +401,6 @@ 'misc/capture_context_linux.S', ], }], - ['OS!="android"', { - 'sources!': [ - 'net/http_transport_none.cc', - ], - }], ['OS!="linux" and OS!="android"', { 'sources/': [ ['exclude', '^process/'],