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

Side by Side Diff: chrome/browser/extensions/api/system_memory/system_memory_api.cc

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/api/system_memory/system_memory_api.h" 5 #include "chrome/browser/extensions/api/system_memory/system_memory_api.h"
6 6
7 #include "chrome/browser/extensions/api/system_memory/memory_info_provider.h" 7 #include "chrome/browser/extensions/api/system_memory/memory_info_provider.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 using api::system_memory::MemoryInfo; 11 using api::system_memory::MemoryInfo;
12 12
13 SystemMemoryGetInfoFunction::SystemMemoryGetInfoFunction() {} 13 SystemMemoryGetInfoFunction::SystemMemoryGetInfoFunction() {}
14 14
15 SystemMemoryGetInfoFunction::~SystemMemoryGetInfoFunction() {} 15 SystemMemoryGetInfoFunction::~SystemMemoryGetInfoFunction() {}
16 16
17 bool SystemMemoryGetInfoFunction::RunImpl() { 17 bool SystemMemoryGetInfoFunction::RunAsync() {
18 MemoryInfoProvider::Get()->StartQueryInfo( 18 MemoryInfoProvider::Get()->StartQueryInfo(
19 base::Bind(&SystemMemoryGetInfoFunction::OnGetMemoryInfoCompleted, this)); 19 base::Bind(&SystemMemoryGetInfoFunction::OnGetMemoryInfoCompleted, this));
20 return true; 20 return true;
21 } 21 }
22 22
23 void SystemMemoryGetInfoFunction::OnGetMemoryInfoCompleted(bool success) { 23 void SystemMemoryGetInfoFunction::OnGetMemoryInfoCompleted(bool success) {
24 if (success) 24 if (success)
25 SetResult(MemoryInfoProvider::Get()->memory_info().ToValue().release()); 25 SetResult(MemoryInfoProvider::Get()->memory_info().ToValue().release());
26 else 26 else
27 SetError("Error occurred when querying memory information."); 27 SetError("Error occurred when querying memory information.");
28 SendResponse(success); 28 SendResponse(success);
29 } 29 }
30 30
31 } // namespace extensions 31 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698