Commit 96ea5054 authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Allow waiting in background Icing work

The HistoryReportJniBridge.addHistoricVisitsToUsageReportsBuffer() method
runs on a background thread, so it is fine to use base::WaitableEvent
in the underlying JNI functions without affecting responsiveness.

Bug: 943381
Change-Id: I85150cf9ec29de15b3375587b89ccae265490330
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1531029Reviewed-by: default avatarAlbert J. Wong <ajwong@chromium.org>
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646684}
parent ec309e0f
......@@ -168,6 +168,9 @@ class InFlightIO;
namespace functions {
class ExecScriptScopedAllowBaseSyncPrimitives;
}
namespace history_report {
class HistoryReportJniBridge;
}
namespace gpu {
class GpuChannelHost;
}
......@@ -390,6 +393,7 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives {
friend class content::ServiceWorkerContextClient;
friend class content::SessionStorageDatabase;
friend class functions::ExecScriptScopedAllowBaseSyncPrimitives;
friend class history_report::HistoryReportJniBridge;
friend class internal::TaskTracker;
friend class leveldb::LevelDBMojoProxy;
friend class leveldb_env::DBTracker;
......
......@@ -183,6 +183,11 @@ void HistoryReportJniBridge::StartReporting() {
jboolean HistoryReportJniBridge::AddHistoricVisitsToUsageReportsBuffer(
JNIEnv* env,
const JavaParamRef<jobject>& obj) {
DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
// Waiting is okay here because this is called from a background thread
// in Java.
base::ScopedAllowBaseSyncPrimitives allow_sync;
data_provider_->StartVisitMigrationToUsageBuffer(
usage_reports_buffer_service_.get());
// TODO(nileshagrawal): Return true when actually done,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment