Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/system_logs/memorydetails_log_source.h" | |
| 6 | |
| 7 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h" | |
| 8 #include "chrome/browser/memory_details.h" | |
| 9 #include "content/public/browser/browser_thread.h" | |
| 10 | |
| 11 namespace chromeos { | |
| 12 | |
| 13 class SysLogsFetcherMemoryHandler : public MemoryDetails { | |
|
satorux1
2012/08/16 10:50:57
class comment is missing.
tudalex(Chromium)
2012/08/16 22:33:03
Done.
| |
| 14 public: | |
| 15 SysLogsFetcherMemoryHandler( | |
| 16 SysLogsFetcherCallback callback) | |
|
satorux1
2012/08/16 10:50:57
move this to the previous line.
tudalex(Chromium)
2012/08/16 22:33:03
Done.
| |
| 17 : callback_(callback) {} | |
| 18 | |
| 19 // MemoryDetails override. | |
| 20 virtual void OnDetailsAvailable() OVERRIDE { | |
| 21 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
| 22 | |
| 23 scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse); | |
| 24 (*response)["mem_usage"] = ToLogString(); | |
| 25 callback_.Run(response.get()); | |
| 26 } | |
| 27 | |
| 28 private: | |
| 29 virtual ~SysLogsFetcherMemoryHandler() {} | |
| 30 SysLogsFetcherCallback callback_; | |
| 31 | |
| 32 DISALLOW_COPY_AND_ASSIGN(SysLogsFetcherMemoryHandler); | |
| 33 }; | |
| 34 | |
| 35 void MemoryDetailsLogSource::Fetch(const SysLogsFetcherCallback& callback) { | |
| 36 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | |
| 37 DCHECK(!callback.is_null()); | |
| 38 | |
| 39 scoped_refptr<SysLogsFetcherMemoryHandler> | |
| 40 handler(new SysLogsFetcherMemoryHandler(callback)); | |
| 41 // TODO(jamescook): Maybe we don't need to update histograms here? | |
| 42 handler->StartFetch(MemoryDetails::UPDATE_USER_METRICS); | |
| 43 } | |
| 44 | |
| 45 } // namespace chromeos | |
| OLD | NEW |