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

Side by Side Diff: extensions/renderer/dom_activity_logger.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/dom_activity_logger.h" 5 #include "extensions/renderer/dom_activity_logger.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/public/child/v8_value_converter.h" 9 #include "content/public/child/v8_value_converter.h"
10 #include "content/public/renderer/render_thread.h" 10 #include "content/public/renderer/render_thread.h"
(...skipping 18 matching lines...) Expand all
29 base::ListValue* list) { 29 base::ListValue* list) {
30 DCHECK(list); 30 DCHECK(list);
31 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 31 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create());
32 ActivityLogConverterStrategy strategy; 32 ActivityLogConverterStrategy strategy;
33 converter->SetFunctionAllowed(true); 33 converter->SetFunctionAllowed(true);
34 converter->SetStrategy(&strategy); 34 converter->SetStrategy(&strategy);
35 std::unique_ptr<base::Value> value(converter->FromV8Value( 35 std::unique_ptr<base::Value> value(converter->FromV8Value(
36 v8_value, v8::Isolate::GetCurrent()->GetCurrentContext())); 36 v8_value, v8::Isolate::GetCurrent()->GetCurrentContext()));
37 37
38 if (value.get()) 38 if (value.get())
39 list->Append(value.release()); 39 list->Append(std::move(value));
40 } 40 }
41 41
42 } // namespace 42 } // namespace
43 43
44 DOMActivityLogger::DOMActivityLogger(const std::string& extension_id) 44 DOMActivityLogger::DOMActivityLogger(const std::string& extension_id)
45 : extension_id_(extension_id) { 45 : extension_id_(extension_id) {
46 } 46 }
47 47
48 DOMActivityLogger::~DOMActivityLogger() {} 48 DOMActivityLogger::~DOMActivityLogger() {}
49 49
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 params.api_call = api_call; 124 params.api_call = api_call;
125 params.url = url; 125 params.url = url;
126 params.url_title = url_title; 126 params.url_title = url_title;
127 params.call_type = call_type; 127 params.call_type = call_type;
128 params.arguments.Swap(args.get()); 128 params.arguments.Swap(args.get());
129 content::RenderThread::Get()->Send( 129 content::RenderThread::Get()->Send(
130 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); 130 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params));
131 } 131 }
132 132
133 } // namespace extensions 133 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698