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

Side by Side Diff: extensions/browser/api/alarms/alarm_manager.cc

Issue 2137013005: [Extensions] Code Cleanup - Remove redundant smart-ptr get()s (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
« no previous file with comments | « no previous file | extensions/browser/api/app_window/app_window_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/api/alarms/alarm_manager.h" 5 #include "extensions/browser/api/alarms/alarm_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // We don't need to reschedule the poll otherwise, because in 251 // We don't need to reschedule the poll otherwise, because in
252 // the worst case we would just poll one extra time. 252 // the worst case we would just poll one extra time.
253 if (alarms_.empty()) { 253 if (alarms_.empty()) {
254 timer_.Stop(); 254 timer_.Stop();
255 next_poll_time_ = base::Time(); 255 next_poll_time_ = base::Time();
256 } 256 }
257 } 257 }
258 258
259 void AlarmManager::OnAlarm(AlarmIterator it) { 259 void AlarmManager::OnAlarm(AlarmIterator it) {
260 CHECK(it.first != alarms_.end()); 260 CHECK(it.first != alarms_.end());
261 Alarm& alarm = *it.second->get(); 261 Alarm& alarm = **it.second;
262 std::string extension_id_copy(it.first->first); 262 std::string extension_id_copy(it.first->first);
263 delegate_->OnAlarm(extension_id_copy, alarm); 263 delegate_->OnAlarm(extension_id_copy, alarm);
264 264
265 // Update our scheduled time for the next alarm. 265 // Update our scheduled time for the next alarm.
266 if (double* period_in_minutes = alarm.js_alarm->period_in_minutes.get()) { 266 if (double* period_in_minutes = alarm.js_alarm->period_in_minutes.get()) {
267 // Get the timer's delay in JS time (i.e., convert it from minutes to 267 // Get the timer's delay in JS time (i.e., convert it from minutes to
268 // milliseconds). 268 // milliseconds).
269 double period_in_js_time = *period_in_minutes * 269 double period_in_js_time = *period_in_minutes *
270 base::Time::kMicrosecondsPerMinute / 270 base::Time::kMicrosecondsPerMinute /
271 base::Time::kMicrosecondsPerMillisecond; 271 base::Time::kMicrosecondsPerMillisecond;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (create_info.period_in_minutes.get()) { 479 if (create_info.period_in_minutes.get()) {
480 js_alarm->period_in_minutes.reset( 480 js_alarm->period_in_minutes.reset(
481 new double(*create_info.period_in_minutes)); 481 new double(*create_info.period_in_minutes));
482 } 482 }
483 } 483 }
484 484
485 Alarm::~Alarm() { 485 Alarm::~Alarm() {
486 } 486 }
487 487
488 } // namespace extensions 488 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api/app_window/app_window_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698