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

Side by Side Diff: extensions/renderer/script_context.cc

Issue 1899083003: Convert //extensions/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 | « extensions/renderer/script_context.h ('k') | extensions/renderer/script_injection.h » ('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 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/script_context.h" 5 #include "extensions/renderer/script_context.h"
6 6
7 #include <memory>
8
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "content/public/child/v8_value_converter.h" 16 #include "content/public/child/v8_value_converter.h"
16 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
17 #include "content/public/common/url_constants.h" 18 #include "content/public/common/url_constants.h"
18 #include "content/public/renderer/render_frame.h" 19 #include "content/public/renderer/render_frame.h"
19 #include "extensions/common/constants.h" 20 #include "extensions/common/constants.h"
20 #include "extensions/common/extension.h" 21 #include "extensions/common/extension.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 317 }
317 318
318 void ScriptContext::OnResponseReceived(const std::string& name, 319 void ScriptContext::OnResponseReceived(const std::string& name,
319 int request_id, 320 int request_id,
320 bool success, 321 bool success,
321 const base::ListValue& response, 322 const base::ListValue& response,
322 const std::string& error) { 323 const std::string& error) {
323 DCHECK(thread_checker_.CalledOnValidThread()); 324 DCHECK(thread_checker_.CalledOnValidThread());
324 v8::HandleScope handle_scope(isolate()); 325 v8::HandleScope handle_scope(isolate());
325 326
326 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 327 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create());
327 v8::Local<v8::Value> argv[] = { 328 v8::Local<v8::Value> argv[] = {
328 v8::Integer::New(isolate(), request_id), 329 v8::Integer::New(isolate(), request_id),
329 v8::String::NewFromUtf8(isolate(), name.c_str()), 330 v8::String::NewFromUtf8(isolate(), name.c_str()),
330 v8::Boolean::New(isolate(), success), 331 v8::Boolean::New(isolate(), success),
331 converter->ToV8Value(&response, 332 converter->ToV8Value(&response,
332 v8::Local<v8::Context>::New(isolate(), v8_context_)), 333 v8::Local<v8::Context>::New(isolate(), v8_context_)),
333 v8::String::NewFromUtf8(isolate(), error.c_str())}; 334 v8::String::NewFromUtf8(isolate(), error.c_str())};
334 335
335 v8::Local<v8::Value> retval = module_system()->CallModuleMethod( 336 v8::Local<v8::Value> retval = module_system()->CallModuleMethod(
336 "sendRequest", "handleResponse", arraysize(argv), argv); 337 "sendRequest", "handleResponse", arraysize(argv), argv);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 v8::Local<v8::Value> argv[]) { 481 v8::Local<v8::Value> argv[]) {
481 return context_->CallFunction(function, argc, argv); 482 return context_->CallFunction(function, argc, argv);
482 } 483 }
483 484
484 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { 485 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() {
485 v8::HandleScope handle_scope(context_->isolate()); 486 v8::HandleScope handle_scope(context_->isolate());
486 return gin::PerContextData::From(context_->v8_context())->context_holder(); 487 return gin::PerContextData::From(context_->v8_context())->context_holder();
487 } 488 }
488 489
489 } // namespace extensions 490 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_context.h ('k') | extensions/renderer/script_injection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698