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

Side by Side Diff: chrome/test/chromedriver/commands.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 #include "chrome/test/chromedriver/commands.h" 5 #include "chrome/test/chromedriver/commands.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 std::unique_ptr<base::Value> value, 86 std::unique_ptr<base::Value> value,
87 const std::string& session_id) { 87 const std::string& session_id) {
88 if (!session_remaining_count) 88 if (!session_remaining_count)
89 return; 89 return;
90 90
91 (*session_remaining_count)--; 91 (*session_remaining_count)--;
92 92
93 std::unique_ptr<base::DictionaryValue> session(new base::DictionaryValue()); 93 std::unique_ptr<base::DictionaryValue> session(new base::DictionaryValue());
94 session->Set("id", new base::StringValue(session_id)); 94 session->Set("id", new base::StringValue(session_id));
95 session->Set("capabilities", value->DeepCopy()); 95 session->Set("capabilities", value->DeepCopy());
96 session_list->Append(session.release()); 96 session_list->Append(std::move(session));
97 97
98 if (!*session_remaining_count) { 98 if (!*session_remaining_count) {
99 all_get_session_func.Run(); 99 all_get_session_func.Run();
100 } 100 }
101 } 101 }
102 102
103 } // namespace 103 } // namespace
104 104
105 void ExecuteGetSessions(const Command& session_capabilities_command, 105 void ExecuteGetSessions(const Command& session_capabilities_command,
106 SessionThreadMap* session_thread_map, 106 SessionThreadMap* session_thread_map,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 319 }
320 } 320 }
321 321
322 namespace internal { 322 namespace internal {
323 323
324 void CreateSessionOnSessionThreadForTesting(const std::string& id) { 324 void CreateSessionOnSessionThreadForTesting(const std::string& id) {
325 SetThreadLocalSession(base::WrapUnique(new Session(id))); 325 SetThreadLocalSession(base::WrapUnique(new Session(id)));
326 } 326 }
327 327
328 } // namespace internal 328 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698