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/syslogs/memorydetails_fetcher.h" | |
| 6 | |
| 7 #include "chrome/browser/chromeos/syslogs/syslogs_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 { | |
| 14 public: | |
| 15 | |
| 16 SysLogsFetcherMemoryHandler( | |
| 17 SysLogsFetcherCallback request) | |
| 18 : request_(request) {} | |
| 19 | |
| 20 virtual void OnDetailsAvailable() OVERRIDE { | |
| 21 SysLogsResponse* response = new SysLogsResponse; | |
| 22 (*response)["mem_usage"] = ToLogString(); | |
| 23 // This will call the callback on the calling thread. | |
|
rkc
2012/08/06 18:30:18
How?
tudalex(Chromium)
2012/08/06 19:14:22
Left comment from the SysLogsProvider code when I
| |
| 24 request_.Run(response); | |
| 25 } | |
| 26 | |
| 27 private: | |
| 28 virtual ~SysLogsFetcherMemoryHandler() {} | |
| 29 SysLogsFetcherCallback request_; | |
| 30 | |
| 31 DISALLOW_COPY_AND_ASSIGN(SysLogsFetcherMemoryHandler); | |
| 32 }; | |
| 33 | |
| 34 void MemoryDetailsFetcher::Fetch(SysLogsFetcherCallback request){ | |
| 35 scoped_refptr<SysLogsFetcherMemoryHandler> | |
| 36 handler(new SysLogsFetcherMemoryHandler(request)); | |
| 37 // TODO(jamescook): Maybe we don't need to update histograms here? | |
| 38 handler->StartFetch(MemoryDetails::UPDATE_USER_METRICS); | |
| 39 } | |
| 40 | |
| 41 } // namespace chromeos | |
| OLD | NEW |