716cb28430
* chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
173 lines
6.9 KiB
Diff
173 lines
6.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Heilig Benedek <benecene@gmail.com>
|
|
Date: Thu, 18 Oct 2018 17:08:03 -0700
|
|
Subject: tts.patch
|
|
|
|
* Adds patch in //chrome/browser/speech/tts_controller_impl.cc
|
|
to disable calls using chrome profile class.
|
|
* Adds patch in //chrome/browser/speech/tts_message_filter.cc
|
|
to remove reference to browser context when its signaled for
|
|
destruction from content layer.
|
|
|
|
diff --git a/chrome/browser/speech/tts_controller_delegate_impl.cc b/chrome/browser/speech/tts_controller_delegate_impl.cc
|
|
index e96b0cef21bec8925d4adf1e8692dc00f5ec6f5f..7ec07534aa3628873c9fe784fa0235f3c5c7f15f 100644
|
|
--- a/chrome/browser/speech/tts_controller_delegate_impl.cc
|
|
+++ b/chrome/browser/speech/tts_controller_delegate_impl.cc
|
|
@@ -213,6 +213,7 @@ void TtsControllerDelegateImpl::UpdateUtteranceDefaultsFromPrefs(
|
|
const PrefService* TtsControllerDelegateImpl::GetPrefService(
|
|
content::TtsUtterance* utterance) {
|
|
const PrefService* prefs = nullptr;
|
|
+#if 0
|
|
// The utterance->GetBrowserContext() is null in tests.
|
|
if (utterance->GetBrowserContext()) {
|
|
const Profile* profile =
|
|
@@ -220,6 +221,7 @@ const PrefService* TtsControllerDelegateImpl::GetPrefService(
|
|
if (profile)
|
|
prefs = profile->GetPrefs();
|
|
}
|
|
+#endif
|
|
return prefs;
|
|
}
|
|
|
|
diff --git a/chrome/browser/speech/tts_message_filter.cc b/chrome/browser/speech/tts_message_filter.cc
|
|
index a7df91b0f6568215313899b577600feaa8c7ba31..8bccd503bb1648ef1ba07b7ff0fded6caaff8a65 100644
|
|
--- a/chrome/browser/speech/tts_message_filter.cc
|
|
+++ b/chrome/browser/speech/tts_message_filter.cc
|
|
@@ -10,8 +10,11 @@
|
|
#include "base/logging.h"
|
|
#include "base/task/post_task.h"
|
|
#include "chrome/browser/chrome_notification_types.h"
|
|
+#if 0
|
|
#include "chrome/browser/profiles/profile.h"
|
|
+#endif
|
|
#include "chrome/common/tts_messages.h"
|
|
+#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
|
|
#include "content/public/browser/browser_context.h"
|
|
#include "content/public/browser/browser_task_traits.h"
|
|
#include "content/public/browser/notification_service.h"
|
|
@@ -19,6 +22,29 @@
|
|
|
|
using content::BrowserThread;
|
|
|
|
+namespace {
|
|
+
|
|
+class TtsMessageFilterShutdownNotifierFactory
|
|
+ : public BrowserContextKeyedServiceShutdownNotifierFactory {
|
|
+ public:
|
|
+ static TtsMessageFilterShutdownNotifierFactory* GetInstance() {
|
|
+ return base::Singleton<TtsMessageFilterShutdownNotifierFactory>::get();
|
|
+ }
|
|
+
|
|
+ private:
|
|
+ friend struct base::DefaultSingletonTraits<
|
|
+ TtsMessageFilterShutdownNotifierFactory>;
|
|
+
|
|
+ TtsMessageFilterShutdownNotifierFactory()
|
|
+ : BrowserContextKeyedServiceShutdownNotifierFactory("TtsMessageFilter") {}
|
|
+
|
|
+ ~TtsMessageFilterShutdownNotifierFactory() override {}
|
|
+
|
|
+ DISALLOW_COPY_AND_ASSIGN(TtsMessageFilterShutdownNotifierFactory);
|
|
+};
|
|
+
|
|
+} // namespace
|
|
+
|
|
TtsMessageFilter::TtsMessageFilter(content::BrowserContext* browser_context)
|
|
: BrowserMessageFilter(TtsMsgStart),
|
|
browser_context_(browser_context),
|
|
@@ -26,28 +52,27 @@ TtsMessageFilter::TtsMessageFilter(content::BrowserContext* browser_context)
|
|
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
content::TtsController::GetInstance()->AddVoicesChangedDelegate(this);
|
|
|
|
- // TODO(dmazzoni): make it so that we can listen for a BrowserContext
|
|
- // being destroyed rather than a Profile. http://crbug.com/444668
|
|
- Profile* profile = Profile::FromBrowserContext(browser_context);
|
|
- notification_registrar_.Add(this,
|
|
- chrome::NOTIFICATION_PROFILE_DESTROYED,
|
|
- content::Source<Profile>(profile));
|
|
+ browser_context_shutdown_notifier_ =
|
|
+ TtsMessageFilterShutdownNotifierFactory::GetInstance()
|
|
+ ->Get(browser_context)
|
|
+ ->Subscribe(base::Bind(&TtsMessageFilter::BrowserContextDestroyed,
|
|
+ base::RetainedRef(this)));
|
|
|
|
// Balanced in OnChannelClosingInUIThread() to keep the ref-count be non-zero
|
|
// until all pointers to this class are invalidated.
|
|
AddRef();
|
|
}
|
|
|
|
-void TtsMessageFilter::OverrideThreadForMessage(
|
|
- const IPC::Message& message, BrowserThread::ID* thread) {
|
|
+void TtsMessageFilter::OverrideThreadForMessage(const IPC::Message& message,
|
|
+ BrowserThread::ID* thread) {
|
|
switch (message.type()) {
|
|
- case TtsHostMsg_InitializeVoiceList::ID:
|
|
- case TtsHostMsg_Speak::ID:
|
|
- case TtsHostMsg_Pause::ID:
|
|
- case TtsHostMsg_Resume::ID:
|
|
- case TtsHostMsg_Cancel::ID:
|
|
- *thread = BrowserThread::UI;
|
|
- break;
|
|
+ case TtsHostMsg_InitializeVoiceList::ID:
|
|
+ case TtsHostMsg_Speak::ID:
|
|
+ case TtsHostMsg_Pause::ID:
|
|
+ case TtsHostMsg_Resume::ID:
|
|
+ case TtsHostMsg_Cancel::ID:
|
|
+ *thread = BrowserThread::UI;
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
@@ -211,10 +236,8 @@ void TtsMessageFilter::Cleanup() {
|
|
content::TtsController::GetInstance()->RemoveUtteranceEventDelegate(this);
|
|
}
|
|
|
|
-void TtsMessageFilter::Observe(
|
|
- int type,
|
|
- const content::NotificationSource& source,
|
|
- const content::NotificationDetails& details) {
|
|
+void TtsMessageFilter::BrowserContextDestroyed() {
|
|
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
browser_context_ = nullptr;
|
|
- notification_registrar_.RemoveAll();
|
|
+ browser_context_shutdown_notifier_.reset();
|
|
}
|
|
diff --git a/chrome/browser/speech/tts_message_filter.h b/chrome/browser/speech/tts_message_filter.h
|
|
index ffb607fbb275b0a75dba592f2f5f5afb881214e2..99780e56674af749a231f0e85b89e6a6ed3743d6 100644
|
|
--- a/chrome/browser/speech/tts_message_filter.h
|
|
+++ b/chrome/browser/speech/tts_message_filter.h
|
|
@@ -8,6 +8,7 @@
|
|
#include "base/macros.h"
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "base/synchronization/lock.h"
|
|
+#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
|
|
#include "content/public/browser/browser_message_filter.h"
|
|
#include "content/public/browser/browser_thread.h"
|
|
#include "content/public/browser/notification_observer.h"
|
|
@@ -21,7 +22,6 @@ class BrowserContext;
|
|
struct TtsUtteranceRequest;
|
|
|
|
class TtsMessageFilter : public content::BrowserMessageFilter,
|
|
- public content::NotificationObserver,
|
|
public content::UtteranceEventDelegate,
|
|
public content::VoicesChangedDelegate {
|
|
public:
|
|
@@ -64,15 +64,13 @@ class TtsMessageFilter : public content::BrowserMessageFilter,
|
|
// about to be deleted.
|
|
bool Valid();
|
|
|
|
- // content::NotificationObserver implementation.
|
|
- void Observe(int type,
|
|
- const content::NotificationSource& source,
|
|
- const content::NotificationDetails& details) override;
|
|
+ void BrowserContextDestroyed();
|
|
|
|
+ std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
|
|
+ browser_context_shutdown_notifier_;
|
|
content::BrowserContext* browser_context_;
|
|
mutable base::Lock mutex_;
|
|
mutable bool valid_;
|
|
- content::NotificationRegistrar notification_registrar_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter);
|
|
};
|