diff options
30 files changed, 122 insertions, 113 deletions
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index 74eddaf..2388b59 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h @@ -565,6 +565,11 @@ class BASE_EXPORT MessageLoopForUI : public MessageLoop { return static_cast<MessageLoopForUI*>(loop); } + static bool IsCurrent() { + MessageLoop* loop = MessageLoop::current(); + return loop && loop->type() == MessageLoop::TYPE_UI; + } + #if defined(OS_IOS) // On iOS, the main message loop cannot be Run(). Instead call Attach(), // which connects this MessageLoop to the UI thread's CFRunLoop and allows @@ -664,6 +669,11 @@ class BASE_EXPORT MessageLoopForIO : public MessageLoop { return static_cast<MessageLoopForIO*>(loop); } + static bool IsCurrent() { + MessageLoop* loop = MessageLoop::current(); + return loop && loop->type() == MessageLoop::TYPE_IO; + } + void AddIOObserver(IOObserver* io_observer) { pump_io()->AddIOObserver(io_observer); } diff --git a/base/power_monitor/power_monitor_device_source_win.cc b/base/power_monitor/power_monitor_device_source_win.cc index 6609bd0..ba00f2f 100644 --- a/base/power_monitor/power_monitor_device_source_win.cc +++ b/base/power_monitor/power_monitor_device_source_win.cc @@ -63,7 +63,7 @@ bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() { PowerMonitorDeviceSource::PowerMessageWindow::PowerMessageWindow() : instance_(NULL), message_hwnd_(NULL) { - if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) { + if (!MessageLoopForUI::IsCurrent()) { // Creating this window in (e.g.) a renderer inhibits shutdown on Windows. // See http://crbug.com/230122. TODO(vandebo): http://crbug.com/236031 DLOG(ERROR) diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index cb17608..a0640ad 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -1576,7 +1576,7 @@ bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { startup_timer_->SignalStartupComplete( performance_monitor::StartupTimer::STARTUP_NORMAL); - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) views::AcceleratorHandler accelerator_handler; base::RunLoop run_loop(&accelerator_handler); diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index f91a742..1383912 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -247,7 +247,7 @@ void ScreenLocker::OnLoginSuccess(const UserContext& user_context) { } void ScreenLocker::UnlockOnLoginSuccess() { - DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); + DCHECK(base::MessageLoopForUI::IsCurrent()); if (!authentication_capture_.get()) { LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " << "authentication success."; @@ -339,7 +339,7 @@ void ScreenLocker::SetLoginStatusConsumer( // static void ScreenLocker::Show() { content::RecordAction(UserMetricsAction("ScreenLocker_Show")); - DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); + DCHECK(base::MessageLoopForUI::IsCurrent()); // Check whether the currently logged in user is a guest account and if so, // refuse to lock the screen (crosbug.com/23764). @@ -376,7 +376,7 @@ void ScreenLocker::Show() { // static void ScreenLocker::Hide() { - DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); + DCHECK(base::MessageLoopForUI::IsCurrent()); // For a guest/demo user, screen_locker_ would have never been initialized. if (UserManager::Get()->IsLoggedInAsGuest() || UserManager::Get()->IsLoggedInAsDemoUser()) { @@ -413,7 +413,7 @@ void ScreenLocker::InitClass() { ScreenLocker::~ScreenLocker() { VLOG(1) << "Destroying ScreenLocker " << this; - DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); + DCHECK(base::MessageLoopForUI::IsCurrent()); if (authenticator_.get()) authenticator_->SetConsumer(NULL); diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc index 752949a..b414261 100644 --- a/chrome/browser/external_protocol/external_protocol_handler.cc +++ b/chrome/browser/external_protocol/external_protocol_handler.cc @@ -103,7 +103,7 @@ class ExternalDefaultProtocolObserver virtual void SetDefaultWebClientUIState( ShellIntegration::DefaultWebClientUIState state) OVERRIDE { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); // If we are still working out if we're the default, or we've found // out we definately are the default, we end here. @@ -256,7 +256,7 @@ void ExternalProtocolHandler::LaunchUrlWithDelegate(const GURL& url, int render_process_host_id, int tab_contents_id, Delegate* delegate) { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); // Escape the input scheme to be sure that the command does not // have parameters unexpected by the external program. @@ -311,6 +311,6 @@ void ExternalProtocolHandler::RegisterPrefs(PrefRegistrySimple* registry) { // static void ExternalProtocolHandler::PermitLaunchUrl() { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); g_accept_requests = true; } diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc index a5d841d..a159064 100644 --- a/chrome/browser/jankometer.cc +++ b/chrome/browser/jankometer.cc @@ -280,14 +280,14 @@ class UIJankObserver : public base::RefCountedThreadSafe<UIJankObserver>, // attach to the current thread, so this function can be invoked on another // thread to attach it. void AttachToCurrentThread() { - DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_UI); + DCHECK(base::MessageLoopForUI::IsCurrent()); base::MessageLoopForUI::current()->AddObserver(this); base::MessageLoop::current()->AddTaskObserver(this); } // Detaches the observer to the current thread's message loop. void DetachFromCurrentThread() { - DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_UI); + DCHECK(base::MessageLoopForUI::IsCurrent()); base::MessageLoop::current()->RemoveTaskObserver(this); base::MessageLoopForUI::current()->RemoveObserver(this); } diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index ae5a4fd..a899b17 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -44,7 +44,7 @@ PrintJob::PrintJob() DCHECK(ui_message_loop_); // This is normally a UI message loop, but in unit tests, the message loop is // of the 'default' type. - DCHECK(ui_message_loop_->type() == base::MessageLoop::TYPE_UI || + DCHECK(base::MessageLoopForUI::IsCurrent() || ui_message_loop_->type() == base::MessageLoop::TYPE_DEFAULT); ui_message_loop_->AddDestructionObserver(this); } diff --git a/chrome/browser/printing/printer_query.cc b/chrome/browser/printing/printer_query.cc index d05900e..6770e57 100644 --- a/chrome/browser/printing/printer_query.cc +++ b/chrome/browser/printing/printer_query.cc @@ -20,7 +20,7 @@ PrinterQuery::PrinterQuery() is_print_dialog_box_shown_(false), cookie_(PrintSettings::NewCookie()), last_status_(PrintingContext::FAILED) { - DCHECK_EQ(io_message_loop_->type(), base::MessageLoop::TYPE_IO); + DCHECK(base::MessageLoopForIO::IsCurrent()); } PrinterQuery::~PrinterQuery() { diff --git a/chrome/browser/ui/cocoa/external_protocol_dialog.mm b/chrome/browser/ui/cocoa/external_protocol_dialog.mm index e497d86..16332fd 100644 --- a/chrome/browser/ui/cocoa/external_protocol_dialog.mm +++ b/chrome/browser/ui/cocoa/external_protocol_dialog.mm @@ -40,7 +40,7 @@ void ExternalProtocolHandler::RunExternalProtocolDialog( - (id)initWithGURL:(const GURL*)url renderProcessHostId:(int)renderProcessHostId routingId:(int)routingId { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); if (!(self = [super init])) return nil; diff --git a/chrome/browser/ui/gtk/protocol_dialog_gtk.cc b/chrome/browser/ui/gtk/protocol_dialog_gtk.cc index f982d3a..b5d0209 100644 --- a/chrome/browser/ui/gtk/protocol_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/protocol_dialog_gtk.cc @@ -44,7 +44,7 @@ ProtocolDialogGtk::ProtocolDialogGtk( scoped_ptr<const ProtocolDialogDelegate> delegate) : delegate_(delegate.Pass()), creation_time_(base::TimeTicks::Now()) { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); dialog_ = gtk_dialog_new_with_buttons( base::UTF16ToUTF8(delegate_->GetTitleText()).c_str(), diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc index d97741a..f640cfe 100644 --- a/chrome/browser/ui/views/uninstall_view.cc +++ b/chrome/browser/ui/views/uninstall_view.cc @@ -169,7 +169,7 @@ base::string16 UninstallView::GetItemAt(int index) { namespace chrome { int ShowUninstallBrowserPrompt(bool show_delete_profile) { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); int result = content::RESULT_CODE_NORMAL_EXIT; views::AcceleratorHandler accelerator_handler; diff --git a/chrome/browser/ui/views/user_data_dir_dialog_view.cc b/chrome/browser/ui/views/user_data_dir_dialog_view.cc index 2288ddd..6effe52 100644 --- a/chrome/browser/ui/views/user_data_dir_dialog_view.cc +++ b/chrome/browser/ui/views/user_data_dir_dialog_view.cc @@ -103,7 +103,7 @@ void UserDataDirDialogView::FileSelectionCanceled(void* params) { namespace chrome { base::FilePath ShowUserDataDirDialog(const base::FilePath& user_data_dir) { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); // When the window closes, it will delete itself. UserDataDirDialogView* dialog = new UserDataDirDialogView(user_data_dir); views::DialogDelegate::CreateDialogWidget(dialog, NULL, NULL)->Show(); diff --git a/chrome/test/chromedriver/chrome/adb_impl.cc b/chrome/test/chromedriver/chrome/adb_impl.cc index 0fa1478..c4a38f8 100644 --- a/chrome/test/chromedriver/chrome/adb_impl.cc +++ b/chrome/test/chromedriver/chrome/adb_impl.cc @@ -64,7 +64,7 @@ class ResponseBuffer : public base::RefCountedThreadSafe<ResponseBuffer> { void ExecuteCommandOnIOThread( const std::string& command, scoped_refptr<ResponseBuffer> response_buffer, int port) { - CHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + CHECK(base::MessageLoopForIO::IsCurrent()); AdbClientSocket::AdbQuery(port, command, base::Bind(&ResponseBuffer::OnResponse, response_buffer)); } diff --git a/cloud_print/service/win/cloud_print_service_config.cc b/cloud_print/service/win/cloud_print_service_config.cc index d7321f2..d622e64 100644 --- a/cloud_print/service/win/cloud_print_service_config.cc +++ b/cloud_print/service/win/cloud_print_service_config.cc @@ -123,7 +123,7 @@ SetupDialog::SetupDialog() : state_(ServiceController::STATE_NOT_FOUND), worker_("worker") { ui_loop_ = base::MessageLoop::current(); - DCHECK(ui_loop_->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); worker_.StartWithOptions( base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); @@ -140,14 +140,14 @@ void SetupDialog::PostIOTask(const base::Closure& task) { } void SetupDialog::ShowErrorMessageBox(const base::string16& error_message) { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); MessageBox(error_message.c_str(), LoadLocalString(IDS_OPERATION_FAILED_TITLE).c_str(), MB_ICONERROR | MB_OK); } void SetupDialog::AskToCloseChrome() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); MessageBox(LoadLocalString(IDS_ADD_PRINTERS_USING_CHROME).c_str(), LoadLocalString(IDS_CONTINUE_IN_CHROME_TITLE).c_str(), MB_OK); @@ -156,7 +156,7 @@ void SetupDialog::AskToCloseChrome() { void SetupDialog::SetState(ServiceController::State status, const base::string16& user, bool is_logging_enabled) { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); state_ = status; DWORD status_string = 0; @@ -303,14 +303,14 @@ bool SetupDialog::IsLoggingEnabled() const{ } void SetupDialog::UpdateState() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); controller_.UpdateState(); PostUITask(base::Bind(&SetupDialog::SetState, this, controller_.state(), controller_.user(), controller_.is_logging_enabled())); } void SetupDialog::ShowError(const base::string16& error_message) { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); PostUITask(base::Bind(&SetupDialog::SetState, this, ServiceController::STATE_UNKNOWN, @@ -336,7 +336,7 @@ void SetupDialog::Install(const base::string16& user, base::ScopedClosureRunner scoped_update_status( base::Bind(&SetupDialog::UpdateState, this)); - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); SetupListener setup(GetUser()); HRESULT hr = controller_.InstallCheckService(user, password, @@ -404,7 +404,7 @@ void SetupDialog::Install(const base::string16& user, } void SetupDialog::Start() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); HRESULT hr = controller_.StartService(); if (FAILED(hr)) ShowError(hr); @@ -412,7 +412,7 @@ void SetupDialog::Start() { } void SetupDialog::Stop() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); HRESULT hr = controller_.StopService(); if (FAILED(hr)) ShowError(hr); @@ -420,7 +420,7 @@ void SetupDialog::Stop() { } void SetupDialog::Uninstall() { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)); + DCHECK(base::MessageLoopForIO::IsCurrent()); HRESULT hr = controller_.UninstallService(); if (FAILED(hr)) ShowError(hr); diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 5f01211..1d1f1ef 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -1070,7 +1070,7 @@ void BrowserMainLoop::MainMessageLoopRun() { // Android's main message loop is the Java message loop. NOTREACHED(); #else - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); if (parameters_.ui_task) base::MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 57d4af2..25380c8 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -2456,7 +2456,7 @@ void RenderWidgetHostImpl::WindowSnapshotAsyncCallback( } void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) { - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); std::vector<unsigned char> png; diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc index dae8135..20f6169 100644 --- a/media/audio/audio_manager_base.cc +++ b/media/audio/audio_manager_base.cc @@ -97,7 +97,7 @@ AudioManagerBase::AudioManagerBase(AudioLogFactory* audio_log_factory) const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); if (!cmd_line->HasSwitch(switches::kDisableMainThreadAudio) && base::MessageLoopProxy::current().get() && - base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)) { + base::MessageLoopForUI::IsCurrent()) { task_runner_ = base::MessageLoopProxy::current(); return; } diff --git a/net/base/dns_reloader.cc b/net/base/dns_reloader.cc index 1902820..04abcb1 100644 --- a/net/base/dns_reloader.cc +++ b/net/base/dns_reloader.cc @@ -47,7 +47,7 @@ class DnsReloader : public net::NetworkChangeNotifier::DNSObserver { // NetworkChangeNotifier::DNSObserver: virtual void OnDNSChanged() OVERRIDE { - DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_IO); + DCHECK(base::MessageLoopForIO::IsCurrent()); base::AutoLock l(lock_); resolver_generation_++; } diff --git a/net/cert/cert_database_mac.cc b/net/cert/cert_database_mac.cc index 9427be3..3f405f3 100644 --- a/net/cert/cert_database_mac.cc +++ b/net/cert/cert_database_mac.cc @@ -31,7 +31,7 @@ class CertDatabase::Notifier { registered_(false), called_shutdown_(false) { // Ensure an associated CFRunLoop. - DCHECK(message_loop->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); task_runner_ = message_loop->message_loop_proxy(); task_runner_->PostTask(FROM_HERE, base::Bind(&Notifier::Init, diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 64190f0..1682ddc 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -111,7 +111,7 @@ SocketStream::SocketStream(const GURL& url, Delegate* delegate) metrics_(new SocketStreamMetrics(url)) { DCHECK(base::MessageLoop::current()) << "The current base::MessageLoop must exist"; - DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + DCHECK(base::MessageLoopForIO::IsCurrent()) << "The current base::MessageLoop must be TYPE_IO"; DCHECK(delegate_); } @@ -170,7 +170,7 @@ void SocketStream::CheckPrivacyMode() { void SocketStream::Connect() { DCHECK(base::MessageLoop::current()) << "The current base::MessageLoop must exist"; - DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + DCHECK(base::MessageLoopForIO::IsCurrent()) << "The current base::MessageLoop must be TYPE_IO"; if (context_) { context_->ssl_config_service()->GetSSLConfig(&server_ssl_config_); @@ -203,7 +203,7 @@ size_t SocketStream::GetTotalSizeOfPendingWriteBufs() const { bool SocketStream::SendData(const char* data, int len) { DCHECK(base::MessageLoop::current()) << "The current base::MessageLoop must exist"; - DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + DCHECK(base::MessageLoopForIO::IsCurrent()) << "The current base::MessageLoop must be TYPE_IO"; DCHECK_GT(len, 0); @@ -250,7 +250,7 @@ bool SocketStream::SendData(const char* data, int len) { void SocketStream::Close() { DCHECK(base::MessageLoop::current()) << "The current base::MessageLoop must exist"; - DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + DCHECK(base::MessageLoopForIO::IsCurrent()) << "The current base::MessageLoop must be TYPE_IO"; // If next_state_ is STATE_NONE, the socket was not opened, or already // closed. So, return immediately. @@ -265,7 +265,7 @@ void SocketStream::Close() { void SocketStream::RestartWithAuth(const AuthCredentials& credentials) { DCHECK(base::MessageLoop::current()) << "The current base::MessageLoop must exist"; - DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + DCHECK(base::MessageLoopForIO::IsCurrent()) << "The current base::MessageLoop must be TYPE_IO"; DCHECK(proxy_auth_controller_.get()); if (!connection_->socket()) { @@ -358,7 +358,7 @@ void SocketStream::DoClose() { void SocketStream::Finish(int result) { DCHECK(base::MessageLoop::current()) << "The current base::MessageLoop must exist"; - DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) + DCHECK(base::MessageLoopForIO::IsCurrent()) << "The current base::MessageLoop must be TYPE_IO"; DCHECK_LE(result, OK); if (result == OK) diff --git a/remoting/host/desktop_process.cc b/remoting/host/desktop_process.cc index d2cef83..4592bfd 100644 --- a/remoting/host/desktop_process.cc +++ b/remoting/host/desktop_process.cc @@ -31,7 +31,7 @@ DesktopProcess::DesktopProcess( input_task_runner_(input_task_runner), daemon_channel_name_(daemon_channel_name) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_UI); + DCHECK(base::MessageLoopForUI::IsCurrent()); } DesktopProcess::~DesktopProcess() { diff --git a/remoting/host/win/rdp_client.cc b/remoting/host/win/rdp_client.cc index 30a1abc..ef7f74e 100644 --- a/remoting/host/win/rdp_client.cc +++ b/remoting/host/win/rdp_client.cc @@ -128,7 +128,7 @@ void RdpClient::Core::Connect(const webrtc::DesktopSize& screen_size, return; } - DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_UI); + DCHECK(base::MessageLoopForUI::IsCurrent()); DCHECK(!rdp_client_window_); DCHECK(!self_); diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc index 8ad92ad..e97ca07 100644 --- a/ui/base/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc @@ -204,7 +204,7 @@ bool Clipboard::FormatType::operator<(const FormatType& other) const { } Clipboard::Clipboard() { - if (base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI) + if (base::MessageLoopForUI::IsCurrent()) clipboard_owner_.reset(new base::win::MessageWindow()); } diff --git a/ui/base/ime/win/tsf_bridge.cc b/ui/base/ime/win/tsf_bridge.cc index bf28203..efbc285 100644 --- a/ui/base/ime/win/tsf_bridge.cc +++ b/ui/base/ime/win/tsf_bridge.cc @@ -141,7 +141,7 @@ TSFBridgeDelegate::TSFBridgeDelegate() } TSFBridgeDelegate::~TSFBridgeDelegate() { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); if (!IsInitialized()) return; for (TSFDocumentMap::iterator it = tsf_document_map_.begin(); @@ -160,7 +160,7 @@ TSFBridgeDelegate::~TSFBridgeDelegate() { } bool TSFBridgeDelegate::Initialize() { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); if (client_id_ != TF_CLIENTID_NULL) { DVLOG(1) << "Already initialized."; return false; @@ -208,7 +208,7 @@ bool TSFBridgeDelegate::Initialize() { } void TSFBridgeDelegate::OnTextInputTypeChanged(const TextInputClient* client) { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); DCHECK(IsInitialized()); if (client != client_) { @@ -235,7 +235,7 @@ void TSFBridgeDelegate::OnTextLayoutChanged() { } bool TSFBridgeDelegate::CancelComposition() { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); DCHECK(IsInitialized()); TSFDocument* document = GetAssociatedDocument(); @@ -248,7 +248,7 @@ bool TSFBridgeDelegate::CancelComposition() { } bool TSFBridgeDelegate::ConfirmComposition() { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); DCHECK(IsInitialized()); TSFDocument* document = GetAssociatedDocument(); @@ -262,7 +262,7 @@ bool TSFBridgeDelegate::ConfirmComposition() { void TSFBridgeDelegate::SetFocusedClient(HWND focused_window, TextInputClient* client) { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); DCHECK(client); DCHECK(IsInitialized()); if (attached_window_handle_ != focused_window) @@ -283,7 +283,7 @@ void TSFBridgeDelegate::SetFocusedClient(HWND focused_window, } void TSFBridgeDelegate::RemoveFocusedClient(TextInputClient* client) { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); DCHECK(IsInitialized()); if (client_ != client) return; @@ -303,7 +303,7 @@ TextInputClient* TSFBridgeDelegate::GetFocusedTextInputClient() const { } base::win::ScopedComPtr<ITfThreadMgr> TSFBridgeDelegate::GetThreadManager() { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); DCHECK(IsInitialized()); return thread_manager_; } @@ -497,7 +497,7 @@ TSFBridge::~TSFBridge() { // static bool TSFBridge::Initialize() { - if (base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) { + if (!base::MessageLoopForUI::IsCurrent()) { DVLOG(1) << "Do not use TSFBridge without UI thread."; return false; } @@ -515,7 +515,7 @@ bool TSFBridge::Initialize() { // static TSFBridge* TSFBridge::ReplaceForTesting(TSFBridge* bridge) { - if (base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) { + if (!base::MessageLoopForUI::IsCurrent()) { DVLOG(1) << "Do not use TSFBridge without UI thread."; return NULL; } @@ -526,7 +526,7 @@ TSFBridge* TSFBridge::ReplaceForTesting(TSFBridge* bridge) { // static void TSFBridge::Shutdown() { - if (base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) { + if (!base::MessageLoopForUI::IsCurrent()) { DVLOG(1) << "Do not use TSFBridge without UI thread."; } if (tls_tsf_bridge.initialized()) { @@ -539,7 +539,7 @@ void TSFBridge::Shutdown() { // static TSFBridge* TSFBridge::GetInstance() { - if (base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) { + if (!base::MessageLoopForUI::IsCurrent()) { DVLOG(1) << "Do not use TSFBridge without UI thread."; return NULL; } diff --git a/ui/base/ime/win/tsf_input_scope.cc b/ui/base/ime/win/tsf_input_scope.cc index 06481e9..ccfda53 100644 --- a/ui/base/ime/win/tsf_input_scope.cc +++ b/ui/base/ime/win/tsf_input_scope.cc @@ -116,7 +116,7 @@ SetInputScopesFunc g_set_input_scopes = NULL; bool g_get_proc_done = false; SetInputScopesFunc GetSetInputScopes() { - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); // Thread safety is not required because this function is under UI thread. if (!g_get_proc_done) { g_get_proc_done = true; diff --git a/ui/base/test/ui_controls_mac.mm b/ui/base/test/ui_controls_mac.mm index c5e8f75..8634540 100644 --- a/ui/base/test/ui_controls_mac.mm +++ b/ui/base/test/ui_controls_mac.mm @@ -241,7 +241,7 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, bool command, const base::Closure& task) { CHECK(g_ui_controls_enabled); - DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); + DCHECK(base::MessageLoopForUI::IsCurrent()); std::vector<NSEvent*> events; SynthesizeKeyEventsSequence( diff --git a/ui/gfx/ozone/dri/dri_surface_factory.cc b/ui/gfx/ozone/dri/dri_surface_factory.cc index 4db10cf..3ce7bf1 100644 --- a/ui/gfx/ozone/dri/dri_surface_factory.cc +++ b/ui/gfx/ozone/dri/dri_surface_factory.cc @@ -203,7 +203,7 @@ bool DriSurfaceFactory::SchedulePageFlip(gfx::AcceleratedWidget w) { CHECK(state_ == INITIALIZED); // TODO(dnicoara) Change this CHECK once we're running with the threaded // compositor. - CHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); + CHECK(base::MessageLoopForUI::IsCurrent()); // TODO(dnicoara) Once we can handle multiple displays this needs to be // changed. diff --git a/ui/gfx/win/singleton_hwnd.cc b/ui/gfx/win/singleton_hwnd.cc index 2de6a8b..fc4d11f 100644 --- a/ui/gfx/win/singleton_hwnd.cc +++ b/ui/gfx/win/singleton_hwnd.cc @@ -37,8 +37,7 @@ BOOL SingletonHwnd::ProcessWindowMessage(HWND window, } SingletonHwnd::SingletonHwnd() { - if (!base::MessageLoop::current() || - base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) { + if (!base::MessageLoopForUI::IsCurrent()) { // Creating this window in (e.g.) a renderer inhibits shutdown on // Windows. See http://crbug.com/230122 and http://crbug.com/236039. DLOG(ERROR) << "Cannot create windows on non-UI thread!"; diff --git a/webkit/browser/appcache/appcache_update_job_unittest.cc b/webkit/browser/appcache/appcache_update_job_unittest.cc index 3468758..ba3cf9a 100644 --- a/webkit/browser/appcache/appcache_update_job_unittest.cc +++ b/webkit/browser/appcache/appcache_update_job_unittest.cc @@ -617,7 +617,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void StartCacheAttemptTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), GURL("http://failme"), @@ -651,7 +651,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void StartUpgradeAttemptTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); { MakeService(); @@ -718,7 +718,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void CacheAttemptFetchManifestFailTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), GURL("http://failme"), @@ -745,7 +745,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeFetchManifestFailTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), GURL("http://failme"), @@ -783,7 +783,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void ManifestRedirectTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); net::URLRequestJobFactoryImpl* new_factory( new net::URLRequestJobFactoryImpl); @@ -813,7 +813,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void ManifestMissingMimeTypeTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -851,7 +851,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void ManifestNotFoundTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -888,7 +888,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void ManifestGoneTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -914,7 +914,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void CacheAttemptNotModifiedTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -940,7 +940,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeNotModifiedTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -977,7 +977,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeManifestDataUnchangedTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -1027,7 +1027,7 @@ class AppCacheUpdateJobTest : public testing::Test, // See http://code.google.com/p/chromium/issues/detail?id=95101 void Bug95101Test() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -1073,7 +1073,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void BasicCacheAttemptSuccessTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); GURL manifest_url = MockHttpServer::GetMockUrl("files/manifest1"); @@ -1102,7 +1102,7 @@ class AppCacheUpdateJobTest : public testing::Test, void DownloadInterceptEntriesTest() { // Ensures we download intercept entries too. - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); GURL manifest_url = MockHttpServer::GetMockUrl("files/manifest-with-intercept"); MakeService(); @@ -1129,7 +1129,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void BasicUpgradeSuccessTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -1190,7 +1190,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeLoadFromNewestCacheTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -1253,7 +1253,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeNoLoadFromNewestCacheTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -1313,7 +1313,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeLoadFromNewestCacheVaryHeaderTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -1373,7 +1373,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeSuccessMergedTypesTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), @@ -1424,7 +1424,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void CacheAttemptFailUrlFetchTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), @@ -1450,7 +1450,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeFailUrlFetchTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), @@ -1491,7 +1491,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeFailMasterUrlFetchTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); tested_manifest_path_override_ = "files/manifest1-with-notmodified"; @@ -1587,7 +1587,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void EmptyManifestTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -1631,7 +1631,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void EmptyFileTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), @@ -1666,7 +1666,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void RetryRequestTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); // Set some large number of times to return retry. // Expect 1 manifest fetch and 3 retries. @@ -1700,7 +1700,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void RetryNoRetryAfterTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); // Set some large number of times to return retry. // Expect 1 manifest fetch and 0 retries. @@ -1734,7 +1734,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void RetryNonzeroRetryAfterTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); // Set some large number of times to return retry. // Expect 1 request and 0 retry attempts. @@ -1769,7 +1769,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void RetrySuccessTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); // Set 2 as the retry limit (does not exceed the max). // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch. @@ -1803,7 +1803,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void RetryUrlTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); // Set 1 as the retry limit (does not exceed the max). // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch. @@ -1836,7 +1836,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void FailStoreNewestCacheTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); MockAppCacheStorage* storage = @@ -1865,7 +1865,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeFailStoreNewestCacheTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); MockAppCacheStorage* storage = @@ -1911,7 +1911,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MasterEntryFailStoreNewestCacheTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); MockAppCacheStorage* storage = @@ -1961,7 +1961,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeFailMakeGroupObsoleteTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); MockAppCacheStorage* storage = @@ -2002,7 +2002,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MasterEntryFetchManifestFailTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), GURL("http://failme"), 111); @@ -2030,7 +2030,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MasterEntryBadManifestTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), @@ -2057,7 +2057,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MasterEntryManifestNotFoundTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2087,7 +2087,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MasterEntryFailUrlFetchTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), @@ -2118,7 +2118,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MasterEntryAllFailTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2160,7 +2160,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeMasterEntryAllFailTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2215,7 +2215,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MasterEntrySomeFailTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2263,7 +2263,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void UpgradeMasterEntrySomeFailTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2323,7 +2323,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MasterEntryNoUpdateTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup(service_->storage(), @@ -2377,7 +2377,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void StartUpdateMidCacheAttemptTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2464,7 +2464,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void StartUpdateMidNoUpdateTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2545,7 +2545,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void StartUpdateMidDownloadTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2630,7 +2630,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void QueueMasterEntryTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); MakeService(); group_ = new AppCacheGroup( @@ -2680,7 +2680,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void IfModifiedSinceTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); net::URLRequestJobFactoryImpl* new_factory( new net::URLRequestJobFactoryImpl); @@ -2749,7 +2749,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void IfModifiedSinceUpgradeTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", std::string()); @@ -2813,7 +2813,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void IfNoneMatchUpgradeTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\""); net::URLRequestJobFactoryImpl* new_factory( @@ -2876,7 +2876,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void IfNoneMatchRefetchTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\""); net::URLRequestJobFactoryImpl* new_factory( @@ -2912,7 +2912,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void MultipleHeadersRefetchTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); // Verify that code is correct when building multiple extra headers. HttpHeadersRequestTestJob::Initialize( @@ -2951,7 +2951,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void CrossOriginHttpsSuccessTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); GURL manifest_url = MockHttpServer::GetMockHttpsUrl( "files/valid_cross_origin_https_manifest"); @@ -2979,7 +2979,7 @@ class AppCacheUpdateJobTest : public testing::Test, } void CrossOriginHttpsDeniedTest() { - ASSERT_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()); + ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); GURL manifest_url = MockHttpServer::GetMockHttpsUrl( "files/invalid_cross_origin_https_manifest"); diff --git a/win8/metro_driver/ime/ime_popup_monitor.cc b/win8/metro_driver/ime/ime_popup_monitor.cc index a6368ae..a478607 100644 --- a/win8/metro_driver/ime/ime_popup_monitor.cc +++ b/win8/metro_driver/ime/ime_popup_monitor.cc @@ -25,7 +25,7 @@ void CALLBACK ImeEventCallback(HWINEVENTHOOK win_event_hook_handle, DWORD event_time) { // This function is registered to SetWinEventHook to be called back on the UI // thread. - DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); + DCHECK(base::MessageLoopForUI::IsCurrent()); if (!g_observer_) return; |