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

Side by Side Diff: content/browser/speech/endpointer/energy_endpointer.cc

Issue 2119283002: Use container::back() and container::pop_back() for content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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 // To know more about the algorithm used and the original code which this is 5 // To know more about the algorithm used and the original code which this is
6 // based of, see 6 // based of, see
7 // https://wiki.corp.google.com/twiki/bin/view/Main/ChromeGoogleCodeXRef 7 // https://wiki.corp.google.com/twiki/bin/view/Main/ChromeGoogleCodeXRef
8 8
9 #include "content/browser/speech/endpointer/energy_endpointer.h" 9 #include "content/browser/speech/endpointer/energy_endpointer.h"
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 int64_t EnergyEndpointer::HistoryRing::EndTime() const { 93 int64_t EnergyEndpointer::HistoryRing::EndTime() const {
94 int ind = insertion_index_ - 1; 94 int ind = insertion_index_ - 1;
95 if (ind < 0) 95 if (ind < 0)
96 ind = decision_points_.size() - 1; 96 ind = decision_points_.size() - 1;
97 return decision_points_[ind].time_us; 97 return decision_points_[ind].time_us;
98 } 98 }
99 99
100 float EnergyEndpointer::HistoryRing::RingSum(float duration_sec) { 100 float EnergyEndpointer::HistoryRing::RingSum(float duration_sec) {
101 if (!decision_points_.size()) 101 if (decision_points_.empty())
102 return 0.0; 102 return 0.0;
103 103
104 int64_t sum_us = 0; 104 int64_t sum_us = 0;
105 int ind = insertion_index_ - 1; 105 int ind = insertion_index_ - 1;
106 if (ind < 0) 106 if (ind < 0)
107 ind = decision_points_.size() - 1; 107 ind = decision_points_.size() - 1;
108 int64_t end_us = decision_points_[ind].time_us; 108 int64_t end_us = decision_points_[ind].time_us;
109 bool is_on = decision_points_[ind].decision; 109 bool is_on = decision_points_[ind].decision;
110 int64_t start_us = 110 int64_t start_us =
111 end_us - static_cast<int64_t>(0.5 + (1.0e6 * duration_sec)); 111 end_us - static_cast<int64_t>(0.5 + (1.0e6 * duration_sec));
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 decision_threshold_ = params_.min_decision_threshold(); 370 decision_threshold_ = params_.min_decision_threshold();
371 } 371 }
372 } 372 }
373 373
374 EpStatus EnergyEndpointer::Status(int64_t* status_time) const { 374 EpStatus EnergyEndpointer::Status(int64_t* status_time) const {
375 *status_time = history_->EndTime(); 375 *status_time = history_->EndTime();
376 return status_; 376 return status_;
377 } 377 }
378 378
379 } // namespace content 379 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/shared_worker/shared_worker_service_impl.cc ('k') | content/browser/storage_partition_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698