summaryrefslogtreecommitdiffstats
path: root/base/power_monitor
Commit message (Collapse)AuthorAgeFilesLines
* Switch to standard integer types in base/.avi2015-12-265-3/+6
| | | | | | | | | | BUG=138542 TBR=mark@chromium.org NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1538743002 Cr-Commit-Position: refs/heads/master@{#366910}
* base: Use std::move() instead of Pass() for real movable types.danakj2015-11-251-1/+4
| | | | | | | | | | | | | | | Some of our movable types have real move-constructors/assignment operators now. We can use std::move() for these types instead of Pass(). There's still some move-only types that are implemented using an "Rvalue" type emulation, so we have to keep Pass() for those still. R=thestig@chromium.org BUG=557422 Review URL: https://codereview.chromium.org/1479473002 Cr-Commit-Position: refs/heads/master@{#361583}
* Remove all Windows Window Scoped Trackers and Associated Instrumentationrobliao2015-09-291-1/+0
| | | | | | | | | | | | The jank dashboard shows that there is nothing actionable remaining to do here. The sampling profiler should be able to supersede any manual tracking should we need to investigate future jank. BUG=440919 Review URL: https://codereview.chromium.org/1370993003 Cr-Commit-Position: refs/heads/master@{#351254}
* base: Template methods on Timer classes instead of the classes themselves.danakj2015-09-241-1/+1
| | | | | | | | | | | | | | | | | | | The base class for OneShotTimer and DelayedTimer is templated but only the Start method needs to be (which has a TODO to make it go away entirely too). The DelayedTimer class is also templated but only its constructor needs to be, and the type can be inferred at the callsite, so less typing all around. R=thakis@chromium.org TBR=sky,brettw BUG=148832 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1355063004 Cr-Commit-Position: refs/heads/master@{#350496}
* jni_generator: Pass object parameters as JavaParamRef.torne2015-09-041-3/+3
| | | | | | | | | | | | | | | | | | | Pass all object parameters to JNI functions in JavaParamRef<> wrappers. This new type behaves like ScopedJavaLocalRef, but does not free the local reference when it goes out of scope, since the JVM does not allow method parameters to be freed and this causes a warning. This CL only changes the implementation of the generator and the signatures of JNI functions which take JavaParamRef arguments; the minimum required to allow it to compile and work. An implicit cast from JavaParamRef<T> to T is defined, to allow function bodies to remain unaltered. These will be migrated over future CLs and the cast removed. BUG=506850 Review URL: https://codereview.chromium.org/1312153003 Cr-Commit-Position: refs/heads/master@{#347379}
* Remove Unactionable or Low Jank USER32 Instrumentationrobliao2015-06-021-5/+0
| | | | | | | | | | USER32 calls generally do not have an SLA on returning promptly. They do however, generally need to be called on the thread that created the hwnd. There's not much we can do with these calls. BUG=470226 Review URL: https://codereview.chromium.org/1163863003 Cr-Commit-Position: refs/heads/master@{#332322}
* Subject .mm files to the header sorting presubmittapted2015-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | The presubmit is already robust to handle Objective-C .h files. Not checking .mm files just adds extra review burden. Plus I can't just press F5 in Sublime to sort lines in .mm files due to import vs include, so it actually needs some brainpower when adding something and I keep forgetting to do that. This adds .mm to the list of file extensions the header sorting presubmit checks for, and fixes the current mistakes to avoid annoying people on presubmit with this change. BUG=None TBR=keybuk@chromium.org,jamescook@chromium.org,stuartmorgan@chromium.org,xhwang@chromium.org,rsesek@chromium.org,zea@chromium.org R=thakis@chromium.org,jochen@chromium.org Review URL: https://codereview.chromium.org/1133713009 Cr-Commit-Position: refs/heads/master@{#330509}
* Pass FROM_HERE to ObserverListThreadSafe::Notify to improve profile.reillyg2015-02-091-3/+4
| | | | | | | | | | | | | | | ObserverListThreadSafe::Notify is the 4th most called function in a profile generated on my host. This is because all tasks posted from it are stamped with this callsite, providing very little information. This patch forces callers to pass in their own tracking data so that the profile will differentiate between each observer list holder. TBR=garykac@chromium.org,rdsmith@chromium.org,stuartmorgan@chromium.org,gbillock@chromium.org Review URL: https://codereview.chromium.org/877993003 Cr-Commit-Position: refs/heads/master@{#315372}
* Instrumenting all wndprocs to find jank.vadimt2015-01-171-0/+6
| | | | | | | | | | | | PeekMessage calls are still the top source of jank. The theory is that they invoke some synchronous message processing, and this causes jank. I realized that I didn't instrument all wndprocs, which I'm doing now. BUG=440919 Review URL: https://codereview.chromium.org/850213002 Cr-Commit-Position: refs/heads/master@{#312004}
* Standardize usage of virtual/override/final specifiers in base/.dcheng2014-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Google C++ style guide states: Explicitly annotate overrides of virtual functions or virtual destructors with an override or (less frequently) final specifier. Older (pre-C++11) code will use the virtual keyword as an inferior alternative annotation. For clarity, use exactly one of override, final, or virtual when declaring an override. To better conform to these guidelines, the following constructs have been rewritten: - if a base class has a virtual destructor, then: virtual ~Foo(); -> ~Foo() override; - virtual void Foo() override; -> void Foo() override; - virtual void Foo() override final; -> void Foo() final; This patch was automatically generated. The clang plugin can generate fixit hints, which are suggested edits when it is 100% sure it knows how to fix a problem. The hints from the clang plugin were applied to the source tree using the tool in https://codereview.chromium.org/598073004. Several formatting edits by clang-format were manually reverted, due to mangling of some of the more complicate IPC macros. BUG=417463 Review URL: https://codereview.chromium.org/804533005 Cr-Commit-Position: refs/heads/master@{#309527}
* Standardize usage of virtual/override/final in base/dcheng2014-10-211-2/+2
| | | | | | | | | BUG=417463 TBR=danakj@chromium.org Review URL: https://codereview.chromium.org/668783004 Cr-Commit-Position: refs/heads/master@{#300447}
* replace OVERRIDE and FINAL with override and final in base/mostynb2014-10-071-1/+1
| | | | | | | | BUG=417463 Review URL: https://codereview.chromium.org/611153004 Cr-Commit-Position: refs/heads/master@{#298520}
* Make base::PowerMonitor work on Chrome OS.derat2014-10-072-0/+50
| | | | | | | | | | | | | | On Chrome OS, updates about the system power status are received via D-Bus messages on the UI thread. Being in base/, PowerMonitor can't depend on the code in chromeos/ that receives those messages, so make the Chrome OS code instead notify PowerMonitor when it receives updates. BUG=326534 Review URL: https://codereview.chromium.org/622693004 Cr-Commit-Position: refs/heads/master@{#298367}
* Revert of Check to ensure PowerObservers are added and removed on the same ↵dcheng2014-09-053-35/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | thread (patchset #7 id:120001 of https://codereview.chromium.org/502003003/) Reason for revert: Causing failures on Mac try jobs: ExtensionServiceTest.ExternalExtensionAutoAcknowledgement (run #1): [ RUN ] ExtensionServiceTest.ExternalExtensionAutoAcknowledgement [8427:1799:0904/211500:4724222818698:FATAL:power_monitor.cc(38)] Check failed: obs->power_monitor_thread_checker_. Original issue's description: > Check to ensure PowerObservers are added and removed on the same thread > > This behavior is required by ObserverListThreadSafe and may leads to crashes if not followed > > BUG=404767 > > Committed: https://chromium.googlesource.com/chromium/src/+/518c46fbba70c91169bfc0c64b542f06e56b3915 TBR=thakis@chromium.org,brettw@chromium.org,scottmg@chromium.org,bajones@chromium.org NOTREECHECKS=true NOTRY=true BUG=404767 Review URL: https://codereview.chromium.org/544913003 Cr-Commit-Position: refs/heads/master@{#293448}
* Check to ensure PowerObservers are added and removed on the same threadbajones2014-09-043-2/+35
| | | | | | | | | | This behavior is required by ObserverListThreadSafe and may leads to crashes if not followed BUG=404767 Review URL: https://codereview.chromium.org/502003003 Cr-Commit-Position: refs/heads/master@{#293230}
* Removed LOG_GETLASTERROR and LOG_ERRNO macros.vitalybuka@chromium.org2014-05-211-1/+1
| | | | | | | | | | | Most code uses PLOG with the same effect. TBR=bradchen NOTRY=true Review URL: https://codereview.chromium.org/281223002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271949 0039d316-1c4b-4281-b951-d872f2087c98
* Revert of Attempting to resolve a race condition with PowerMonitor ↵scottmg@chromium.org2014-04-055-98/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/179923006/) Reason for revert: Failing interactive_ui_tests dbg: http://build.chromium.org/p/chromium.win/builders/Interactive%20Tests%20(dbg)/builds/47083/steps/interactive_ui_tests/logs/stdio Original issue's description: > Attempting to resolve a race condition with PowerMonitor. > > ThreadSanitizer caught multiple instances where PowerMonitor::Get or PowerMonitor::Add/RemoveObserver were being called concurrently with the PowerMonitor constructor in the main thread. These functions access a process-global PowerMontior instance (g_power_monitor), which was not thread safe. > > This change adds locks around PowerMonitor creation and deletion, and forces Add/RemoveObserver to be called in a threadsafe manner. It also removes the need to call PowerMonitor::Get. > > BUG=268924 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=262018 TBR=mattm@chromium.org,jyasskin@chromium.org,kbr@chromium.org,bradnelson@chromium.org,brettw@chromium.org,bradchen@chromium.org,willchan@chromium.org,jam@chromium.org,jochen@chromium.org,timurrrr@chromium.org,glider@chromium.org,acolwell@chromium.org,scherkus@chromium.org,bajones@chromium.org NOTREECHECKS=true NOTRY=true BUG=268924 Review URL: https://codereview.chromium.org/226263008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262026 0039d316-1c4b-4281-b951-d872f2087c98
* Attempting to resolve a race condition with PowerMonitor.bajones@chromium.org2014-04-055-51/+98
| | | | | | | | | | | | ThreadSanitizer caught multiple instances where PowerMonitor::Get or PowerMonitor::Add/RemoveObserver were being called concurrently with the PowerMonitor constructor in the main thread. These functions access a process-global PowerMontior instance (g_power_monitor), which was not thread safe. This change adds locks around PowerMonitor creation and deletion, and forces Add/RemoveObserver to be called in a threadsafe manner. It also removes the need to call PowerMonitor::Get. BUG=268924 Review URL: https://codereview.chromium.org/179923006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262018 0039d316-1c4b-4281-b951-d872f2087c98
* Removes MessageLoop::Type checks in favor of IsCurrent on MessageLoops.sky@chromium.org2014-01-201-1/+1
| | | | | | | | | | | | This is part of removing the MessageLoop::Type enum. BUG=none TEST=none R=darin@chromium.org Review URL: https://codereview.chromium.org/141683005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245882 0039d316-1c4b-4281-b951-d872f2087c98
* Fix WM_POWERBROADCAST handlingyukawa@chromium.org2013-11-052-59/+36
| | | | | | | | | | | | | This is a follow up CL of r185433, which mistook |message| for |wparam|. With this CL, base::PowerMonitor and base::PowerObserver become functional again on Windows. BUG=314477, 149059 TEST=manually done with a debugger (by disconnecting the power supply cable) Review URL: https://codereview.chromium.org/57383002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232900 0039d316-1c4b-4281-b951-d872f2087c98
* Moved power_monitor_test_base to a more appropriate locationbajones@chromium.org2013-08-093-115/+1
| | | | | | | | | | | BUG=236031 R=brettw@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=216592 Review URL: https://codereview.chromium.org/22482002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216716 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 216592 "Moved power_monitor_test_base to a more appropria..."nhiroki@chromium.org2013-08-093-1/+115
| | | | | | | | | | | | | | | | | | | | This is likely to cause compile failure. http://build.chromium.org/p/chromium.win/buildstatus?builder=Win%20x64%20Builder&number=8821 http://build.chromium.org/p/chromium.win/buildstatus?builder=Win%20Aura%20Builder&number=10861 > Moved power_monitor_test_base to a more appropriate location > > BUG=236031 > R=brettw@chromium.org > > Review URL: https://codereview.chromium.org/22482002 TBR=bajones@chromium.org Review URL: https://codereview.chromium.org/22569005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216601 0039d316-1c4b-4281-b951-d872f2087c98
* Moved power_monitor_test_base to a more appropriate locationbajones@chromium.org2013-08-093-115/+1
| | | | | | | | | BUG=236031 R=brettw@chromium.org Review URL: https://codereview.chromium.org/22482002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216592 0039d316-1c4b-4281-b951-d872f2087c98
* Created multi-process-friendly PowerMonitor interface.bajones@chromium.org2013-08-0215-269/+522
| | | | | | | | | | | | | PowerMonitor status is now captured in the browser process, which has the appropriate UI thread, and then sent via IPC to other processes which are interested in the power state. BUG=236031 R=apatrick@chromium.org, jam@chromium.org, jar@chromium.org, jvoung@chromium.org, kbr@chromium.org, mpcomplete@chromium.org, palmer@chromium.org, piman@chromium.org, vandebo@chromium.org Review URL: https://codereview.chromium.org/17074009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215381 0039d316-1c4b-4281-b951-d872f2087c98
* Use a direct include of the message_loop header in base/.avi@chromium.org2013-07-181-1/+1
| | | | | | | | | | BUG=260807 TEST=none TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/19224003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212281 0039d316-1c4b-4281-b951-d872f2087c98
* Use a direct include of time headers in base/, part 2.avi@chromium.org2013-06-282-2/+2
| | | | | | | | | | BUG=254986 TEST=none TBR=ben@chromium.org Review URL: https://codereview.chromium.org/18119002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209144 0039d316-1c4b-4281-b951-d872f2087c98
* Fix blocking of shutdown on Windowsscottmg@chromium.org2013-05-021-0/+7
| | | | | | | | | | | | | | | | | Some code was creating windows in the renderer process. These windows are included in Windows' enumeration of a renderer's threads at log off/shutdown. Renderers do not have a UI message loop (aren't pumped) and so don't respond to messages that Windows sends during shutdown. As a result, they appear hung, and shutdown is blocked. Remove two locations that were creating windows, and add a DCHECK that the main renderer thread does not create windows. BUG=230122,236031,236039 Review URL: https://chromiumcodereview.appspot.com/14305025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197922 0039d316-1c4b-4281-b951-d872f2087c98
* Split the power monitoring feature from SystemMonitorhongbo.min@intel.com2013-04-0310-0/+714
The SystemMonitor is a mixed monitor which not only monitors the power state changes but also the devices changes. This patch is to separate the power monitor from SystemMonitor as a new class PowerMonitor which is dedicated to monitor power state. The next step is to seek a opportunity to refactor SystemMonitor as something like DeviceMonitor. BUG=149059 TEST=base_unittests --gtest_filter=PowerMonitorTest.* Review URL: https://chromiumcodereview.appspot.com/10959020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192114 0039d316-1c4b-4281-b951-d872f2087c98