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

Side by Side Diff: chrome/browser/chromeos/system/memorydetails_fetcher.cc

Issue 10827130: Refactoring the SysInfoProvider. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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
(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/memorydetails_fetcher.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/command_line.h"
10 #include "base/file_path.h"
11 #include "base/file_util.h"
12 #include "base/logging.h"
13 #include "base/string_util.h"
14 #include "base/memory/singleton.h"
15 #include "base/memory/weak_ptr.h"
16 #include "base/threading/thread.h"
17 #include "chrome/browser/chromeos/system/syslogs_fetcher.h"
18 #include "chrome/browser/memory_details.h"
19 #include "content/public/browser/browser_thread.h"
20
21 namespace chromeos {
22 namespace system {
23
24 class SysLogsFetcherMemoryHandler : public MemoryDetails {
25 public:
26
27 SysLogsFetcherMemoryHandler(
28 SysLogsFetcherCallback request)
29 : request_(request) { }
30
31 virtual void OnDetailsAvailable() OVERRIDE {
32 SysInfoResponse* response = new SysInfoResponse;
33 (*response)["mem_usage"] = ToLogString();
34 // This will call the callback on the calling thread.
35 request_.Run(response);
36 }
37
38 private:
39 virtual ~SysLogsFetcherMemoryHandler() {}
40 SysLogsFetcherCallback request_;
rkc1 2012/08/04 01:15:05 Indentation.
tudalex(Chromium) 2012/08/05 01:15:12 Done.
41 DISALLOW_COPY_AND_ASSIGN(SysLogsFetcherMemoryHandler);
rkc1 2012/08/04 01:15:05 Newline above.
tudalex(Chromium) 2012/08/05 01:15:12 Done.
42 };
43
44 void MemoryDetailsFetcher::Fetch(SysLogsFetcherCallback request){
45 scoped_refptr<SysLogsFetcherMemoryHandler>
46 handler(new SysLogsFetcherMemoryHandler(request));
47 // TODO(jamescook): Maybe we don't need to update histograms here?
48 handler->StartFetch(MemoryDetails::UPDATE_USER_METRICS);
49 }
50
51 } // namespace system
52 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698