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

Side by Side Diff: chrome/browser/extensions/api/metrics_private/metrics_private_api.cc

Issue 252653002: Rename (Chrome)SyncExtensionFunction::RunImpl to RunSync so that the RunImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
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/extensions/api/metrics_private/metrics_private_api.h" 5 #include "chrome/browser/extensions/api/metrics_private/metrics_private_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 21 matching lines...) Expand all
32 namespace RecordMediumTime = api::metrics_private::RecordMediumTime; 32 namespace RecordMediumTime = api::metrics_private::RecordMediumTime;
33 namespace RecordLongTime = api::metrics_private::RecordLongTime; 33 namespace RecordLongTime = api::metrics_private::RecordLongTime;
34 34
35 namespace { 35 namespace {
36 36
37 const size_t kMaxBuckets = 10000; // We don't ever want more than these many 37 const size_t kMaxBuckets = 10000; // We don't ever want more than these many
38 // buckets; there is no real need for them 38 // buckets; there is no real need for them
39 // and would cause crazy memory usage 39 // and would cause crazy memory usage
40 } // namespace 40 } // namespace
41 41
42 bool MetricsPrivateGetIsCrashReportingEnabledFunction::RunImpl() { 42 bool MetricsPrivateGetIsCrashReportingEnabledFunction::RunSync() {
43 SetResult(new base::FundamentalValue( 43 SetResult(new base::FundamentalValue(
44 MetricsServiceHelper::IsCrashReportingEnabled())); 44 MetricsServiceHelper::IsCrashReportingEnabled()));
45 return true; 45 return true;
46 } 46 }
47 47
48 bool MetricsPrivateGetFieldTrialFunction::RunImpl() { 48 bool MetricsPrivateGetFieldTrialFunction::RunSync() {
49 std::string name; 49 std::string name;
50 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name)); 50 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name));
51 51
52 SetResult(new base::StringValue(base::FieldTrialList::FindFullName(name))); 52 SetResult(new base::StringValue(base::FieldTrialList::FindFullName(name)));
53 return true; 53 return true;
54 } 54 }
55 55
56 bool MetricsPrivateGetVariationParamsFunction::RunImpl() { 56 bool MetricsPrivateGetVariationParamsFunction::RunSync() {
57 scoped_ptr<GetVariationParams::Params> params( 57 scoped_ptr<GetVariationParams::Params> params(
58 GetVariationParams::Params::Create(*args_)); 58 GetVariationParams::Params::Create(*args_));
59 EXTENSION_FUNCTION_VALIDATE(params.get()); 59 EXTENSION_FUNCTION_VALIDATE(params.get());
60 60
61 GetVariationParams::Results::Params result; 61 GetVariationParams::Results::Params result;
62 if (!chrome_variations::GetVariationParams( 62 if (!chrome_variations::GetVariationParams(
63 params->name, &result.additional_properties)) { 63 params->name, &result.additional_properties)) {
64 SetError("Variation parameters are unavailable."); 64 SetError("Variation parameters are unavailable.");
65 return false; 65 return false;
66 } 66 }
67 67
68 SetResult(result.ToValue().release()); 68 SetResult(result.ToValue().release());
69 return true; 69 return true;
70 } 70 }
71 71
72 bool MetricsPrivateRecordUserActionFunction::RunImpl() { 72 bool MetricsPrivateRecordUserActionFunction::RunSync() {
73 scoped_ptr<RecordUserAction::Params> params( 73 scoped_ptr<RecordUserAction::Params> params(
74 RecordUserAction::Params::Create(*args_)); 74 RecordUserAction::Params::Create(*args_));
75 EXTENSION_FUNCTION_VALIDATE(params.get()); 75 EXTENSION_FUNCTION_VALIDATE(params.get());
76 76
77 content::RecordComputedAction(params->name); 77 content::RecordComputedAction(params->name);
78 return true; 78 return true;
79 } 79 }
80 80
81 bool MetricsHistogramHelperFunction::RecordValue( 81 bool MetricsHistogramHelperFunction::RecordValue(
82 const std::string& name, 82 const std::string& name,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 bool MetricsPrivateRecordLongTimeFunction::RunImpl() { 190 bool MetricsPrivateRecordLongTimeFunction::RunImpl() {
191 scoped_ptr<RecordLongTime::Params> params( 191 scoped_ptr<RecordLongTime::Params> params(
192 RecordLongTime::Params::Create(*args_)); 192 RecordLongTime::Params::Create(*args_));
193 EXTENSION_FUNCTION_VALIDATE(params.get()); 193 EXTENSION_FUNCTION_VALIDATE(params.get());
194 static const int kOneHourMs = 60 * 60 * 1000; 194 static const int kOneHourMs = 60 * 60 * 1000;
195 return RecordValue(params->metric_name, base::HISTOGRAM, 195 return RecordValue(params->metric_name, base::HISTOGRAM,
196 1, kOneHourMs, 50, params->value); 196 1, kOneHourMs, 50, params->value);
197 } 197 }
198 198
199 } // namespace extensions 199 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698