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

Side by Side Diff: chrome/browser/low_memory_observer.cc

Issue 10151005: cros: Log per-process memory use on low memory events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/system/syslogs_provider.cc ('k') | chrome/browser/memory_details.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/low_memory_observer.h" 5 #include "chrome/browser/low_memory_observer.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/chromeos/chromeos_version.h" 10 #include "base/chromeos/chromeos_version.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 base::Callback<void(void)> callback = base::Bind(&DiscardTab); 83 base::Callback<void(void)> callback = base::Bind(&DiscardTab);
84 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); 84 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
85 owner_->ScheduleNextObservation(); 85 owner_->ScheduleNextObservation();
86 } 86 }
87 87
88 // Sends off a discard request to the OomPriorityManager. Must be run on 88 // Sends off a discard request to the OomPriorityManager. Must be run on
89 // the UI thread. 89 // the UI thread.
90 static void DiscardTab() { 90 static void DiscardTab() {
91 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 91 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
92 if (g_browser_process && g_browser_process->oom_priority_manager()) 92 if (g_browser_process && g_browser_process->oom_priority_manager())
93 g_browser_process->oom_priority_manager()->DiscardTab(); 93 g_browser_process->oom_priority_manager()->LogMemoryAndDiscardTab();
94 } 94 }
95 private: 95 private:
96 LowMemoryObserverImpl* owner_; 96 LowMemoryObserverImpl* owner_;
97 DISALLOW_COPY_AND_ASSIGN(FileWatcherDelegate); 97 DISALLOW_COPY_AND_ASSIGN(FileWatcherDelegate);
98 }; 98 };
99 99
100 scoped_ptr<MessageLoopForIO::FileDescriptorWatcher> watcher_; 100 scoped_ptr<MessageLoopForIO::FileDescriptorWatcher> watcher_;
101 FileWatcherDelegate watcher_delegate_; 101 FileWatcherDelegate watcher_delegate_;
102 int file_descriptor_; 102 int file_descriptor_;
103 base::OneShotTimer<LowMemoryObserverImpl> timer_; 103 base::OneShotTimer<LowMemoryObserverImpl> timer_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 void LowMemoryObserver::Stop() { 175 void LowMemoryObserver::Stop() {
176 BrowserThread::PostTask( 176 BrowserThread::PostTask(
177 BrowserThread::FILE, 177 BrowserThread::FILE,
178 FROM_HERE, 178 FROM_HERE,
179 base::Bind(&LowMemoryObserverImpl::StopObservingOnFileThread, 179 base::Bind(&LowMemoryObserverImpl::StopObservingOnFileThread,
180 observer_.get())); 180 observer_.get()));
181 } 181 }
182 182
183 } // namespace browser 183 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/syslogs_provider.cc ('k') | chrome/browser/memory_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698