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: net/proxy/proxy_resolver_v8.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « net/proxy/proxy_resolver_perftest.cc ('k') | net/proxy/proxy_resolver_v8_tracing.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 "net/proxy/proxy_resolver_v8.h" 5 #include "net/proxy/proxy_resolver_v8.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdio> 8 #include <cstdio>
9 #include <utility>
9 10
10 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/debug/leak_annotations.h" 13 #include "base/debug/leak_annotations.h"
13 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/strings/string_tokenizer.h" 17 #include "base/strings/string_tokenizer.h"
17 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 mutable base::Lock lock_; 820 mutable base::Lock lock_;
820 ProxyResolverV8::JSBindings* js_bindings_; 821 ProxyResolverV8::JSBindings* js_bindings_;
821 v8::Isolate* isolate_; 822 v8::Isolate* isolate_;
822 v8::Persistent<v8::External> v8_this_; 823 v8::Persistent<v8::External> v8_this_;
823 v8::Persistent<v8::Context> v8_context_; 824 v8::Persistent<v8::Context> v8_context_;
824 }; 825 };
825 826
826 // ProxyResolverV8 ------------------------------------------------------------ 827 // ProxyResolverV8 ------------------------------------------------------------
827 828
828 ProxyResolverV8::ProxyResolverV8(scoped_ptr<Context> context) 829 ProxyResolverV8::ProxyResolverV8(scoped_ptr<Context> context)
829 : context_(context.Pass()) { 830 : context_(std::move(context)) {
830 DCHECK(context_); 831 DCHECK(context_);
831 } 832 }
832 833
833 ProxyResolverV8::~ProxyResolverV8() {} 834 ProxyResolverV8::~ProxyResolverV8() {}
834 835
835 int ProxyResolverV8::GetProxyForURL(const GURL& query_url, 836 int ProxyResolverV8::GetProxyForURL(const GURL& query_url,
836 ProxyInfo* results, 837 ProxyInfo* results,
837 ProxyResolverV8::JSBindings* bindings) { 838 ProxyResolverV8::JSBindings* bindings) {
838 return context_->ResolveProxy(query_url, results, bindings); 839 return context_->ResolveProxy(query_url, results, bindings);
839 } 840 }
840 841
841 // static 842 // static
842 int ProxyResolverV8::Create( 843 int ProxyResolverV8::Create(
843 const scoped_refptr<ProxyResolverScriptData>& script_data, 844 const scoped_refptr<ProxyResolverScriptData>& script_data,
844 ProxyResolverV8::JSBindings* js_bindings, 845 ProxyResolverV8::JSBindings* js_bindings,
845 scoped_ptr<ProxyResolverV8>* resolver) { 846 scoped_ptr<ProxyResolverV8>* resolver) {
846 DCHECK(script_data.get()); 847 DCHECK(script_data.get());
847 DCHECK(js_bindings); 848 DCHECK(js_bindings);
848 849
849 if (script_data->utf16().empty()) 850 if (script_data->utf16().empty())
850 return ERR_PAC_SCRIPT_FAILED; 851 return ERR_PAC_SCRIPT_FAILED;
851 852
852 // Try parsing the PAC script. 853 // Try parsing the PAC script.
853 scoped_ptr<Context> context( 854 scoped_ptr<Context> context(
854 new Context(g_isolate_factory.Get().GetSharedIsolate())); 855 new Context(g_isolate_factory.Get().GetSharedIsolate()));
855 int rv = context->InitV8(script_data, js_bindings); 856 int rv = context->InitV8(script_data, js_bindings);
856 if (rv == OK) 857 if (rv == OK)
857 resolver->reset(new ProxyResolverV8(context.Pass())); 858 resolver->reset(new ProxyResolverV8(std::move(context)));
858 return rv; 859 return rv;
859 } 860 }
860 861
861 // static 862 // static
862 size_t ProxyResolverV8::GetTotalHeapSize() { 863 size_t ProxyResolverV8::GetTotalHeapSize() {
863 v8::Isolate* isolate = 864 v8::Isolate* isolate =
864 g_isolate_factory.Get().GetSharedIsolateWithoutCreating(); 865 g_isolate_factory.Get().GetSharedIsolateWithoutCreating();
865 if (!isolate) 866 if (!isolate)
866 return 0; 867 return 0;
867 868
(...skipping 12 matching lines...) Expand all
880 return 0; 881 return 0;
881 882
882 v8::Locker locked(isolate); 883 v8::Locker locked(isolate);
883 v8::Isolate::Scope isolate_scope(isolate); 884 v8::Isolate::Scope isolate_scope(isolate);
884 v8::HeapStatistics heap_statistics; 885 v8::HeapStatistics heap_statistics;
885 isolate->GetHeapStatistics(&heap_statistics); 886 isolate->GetHeapStatistics(&heap_statistics);
886 return heap_statistics.used_heap_size(); 887 return heap_statistics.used_heap_size();
887 } 888 }
888 889
889 } // namespace net 890 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_perftest.cc ('k') | net/proxy/proxy_resolver_v8_tracing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698