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

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

Issue 2551723002: Replace unique_ptr.reset/release with std::move under src/extensions (Closed)
Patch Set: Created 4 years 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/cast_channel/cast_message_util.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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 void AlarmManager::WriteToStorage(const std::string& extension_id) { 302 void AlarmManager::WriteToStorage(const std::string& extension_id) {
303 StateStore* storage = ExtensionSystem::Get(browser_context_)->state_store(); 303 StateStore* storage = ExtensionSystem::Get(browser_context_)->state_store();
304 if (!storage) 304 if (!storage)
305 return; 305 return;
306 306
307 std::unique_ptr<base::Value> alarms; 307 std::unique_ptr<base::Value> alarms;
308 AlarmMap::iterator list = alarms_.find(extension_id); 308 AlarmMap::iterator list = alarms_.find(extension_id);
309 if (list != alarms_.end()) 309 if (list != alarms_.end())
310 alarms = AlarmsToValue(list->second); 310 alarms = AlarmsToValue(list->second);
311 else 311 else
312 alarms.reset(AlarmsToValue(AlarmList()).release()); 312 alarms = AlarmsToValue(AlarmList());
313 storage->SetExtensionValue(extension_id, kRegisteredAlarms, 313 storage->SetExtensionValue(extension_id, kRegisteredAlarms,
314 std::move(alarms)); 314 std::move(alarms));
315 } 315 }
316 316
317 void AlarmManager::ReadFromStorage(const std::string& extension_id, 317 void AlarmManager::ReadFromStorage(const std::string& extension_id,
318 bool is_unpacked, 318 bool is_unpacked,
319 std::unique_ptr<base::Value> value) { 319 std::unique_ptr<base::Value> value) {
320 base::ListValue* list = NULL; 320 base::ListValue* list = NULL;
321 if (value.get() && value->GetAsList(&list)) { 321 if (value.get() && value->GetAsList(&list)) {
322 AlarmList alarm_states = AlarmsFromValue(extension_id, is_unpacked, list); 322 AlarmList alarm_states = AlarmsFromValue(extension_id, is_unpacked, list);
(...skipping 156 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/cast_channel/cast_message_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698