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

Side by Side Diff: extensions/browser/process_manager.cc

Issue 2085673002: Remove calls to MessageLoop::current() in extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/process_manager.h" 5 #include "extensions/browser/process_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
15 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
16 #include "base/stl_util.h" 15 #include "base/stl_util.h"
17 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
18 #include "base/time/time.h" 17 #include "base/time/time.h"
19 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
20 #include "content/public/browser/devtools_agent_host.h" 19 #include "content/public/browser/devtools_agent_host.h"
21 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/render_frame_host.h" 21 #include "content/public/browser/render_frame_host.h"
23 #include "content/public/browser/render_process_host.h" 22 #include "content/public/browser/render_process_host.h"
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 keepalive_impulse_decrement_callback_for_testing_; 813 keepalive_impulse_decrement_callback_for_testing_;
815 callback_may_clear_callbacks_reentrantly.Run(i->first); 814 callback_may_clear_callbacks_reentrantly.Run(i->first);
816 } 815 }
817 } 816 }
818 817
819 i->second.previous_keepalive_impulse = i->second.keepalive_impulse; 818 i->second.previous_keepalive_impulse = i->second.keepalive_impulse;
820 i->second.keepalive_impulse = false; 819 i->second.keepalive_impulse = false;
821 } 820 }
822 821
823 // OnKeepaliveImpulseCheck() is always called in constructor, but in unit 822 // OnKeepaliveImpulseCheck() is always called in constructor, but in unit
824 // tests there will be no message loop. In that event don't schedule tasks. 823 // tests there will be no thread task runner handle. In that event don't
825 if (base::MessageLoop::current()) { 824 // schedule tasks.
825 if (base::ThreadTaskRunnerHandle::IsSet()) {
826 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 826 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
827 FROM_HERE, base::Bind(&ProcessManager::OnKeepaliveImpulseCheck, 827 FROM_HERE, base::Bind(&ProcessManager::OnKeepaliveImpulseCheck,
828 weak_ptr_factory_.GetWeakPtr()), 828 weak_ptr_factory_.GetWeakPtr()),
829 base::TimeDelta::FromMilliseconds(g_event_page_idle_time_msec)); 829 base::TimeDelta::FromMilliseconds(g_event_page_idle_time_msec));
830 } 830 }
831 } 831 }
832 832
833 void ProcessManager::OnLazyBackgroundPageIdle(const std::string& extension_id, 833 void ProcessManager::OnLazyBackgroundPageIdle(const std::string& extension_id,
834 uint64_t sequence_id) { 834 uint64_t sequence_id) {
835 ExtensionHost* host = GetBackgroundHostForExtension(extension_id); 835 ExtensionHost* host = GetBackgroundHostForExtension(extension_id);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 if (extension && !IncognitoInfo::IsSplitMode(extension)) { 988 if (extension && !IncognitoInfo::IsSplitMode(extension)) {
989 BrowserContext* original_context = 989 BrowserContext* original_context =
990 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context()); 990 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context());
991 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url); 991 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url);
992 } 992 }
993 993
994 return ProcessManager::GetSiteInstanceForURL(url); 994 return ProcessManager::GetSiteInstanceForURL(url);
995 } 995 }
996 996
997 } // namespace extensions 997 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698