OLD | NEW |
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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
13 #include "base/debug/leak_annotations.h" | 12 #include "base/debug/leak_annotations.h" |
14 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
15 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" |
16 #include "base/strings/string_tokenizer.h" | 16 #include "base/strings/string_tokenizer.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "gin/array_buffer.h" | 20 #include "gin/array_buffer.h" |
21 #include "gin/public/isolate_holder.h" | 21 #include "gin/public/isolate_holder.h" |
22 #include "gin/v8_initializer.h" | 22 #include "gin/v8_initializer.h" |
23 #include "net/base/ip_address_number.h" | 23 #include "net/base/ip_address_number.h" |
24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
25 #include "net/proxy/proxy_info.h" | 25 #include "net/proxy/proxy_info.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // External string wrapper so V8 can access the UTF16 string wrapped by | 90 // External string wrapper so V8 can access the UTF16 string wrapped by |
91 // ProxyResolverScriptData. | 91 // ProxyResolverScriptData. |
92 class V8ExternalStringFromScriptData | 92 class V8ExternalStringFromScriptData |
93 : public v8::String::ExternalStringResource { | 93 : public v8::String::ExternalStringResource { |
94 public: | 94 public: |
95 explicit V8ExternalStringFromScriptData( | 95 explicit V8ExternalStringFromScriptData( |
96 const scoped_refptr<ProxyResolverScriptData>& script_data) | 96 const scoped_refptr<ProxyResolverScriptData>& script_data) |
97 : script_data_(script_data) {} | 97 : script_data_(script_data) {} |
98 | 98 |
99 const uint16_t* data() const override { | 99 const uint16_t* data() const override { |
100 return reinterpret_cast<const uint16*>(script_data_->utf16().data()); | 100 return reinterpret_cast<const uint16_t*>(script_data_->utf16().data()); |
101 } | 101 } |
102 | 102 |
103 size_t length() const override { return script_data_->utf16().size(); } | 103 size_t length() const override { return script_data_->utf16().size(); } |
104 | 104 |
105 private: | 105 private: |
106 const scoped_refptr<ProxyResolverScriptData> script_data_; | 106 const scoped_refptr<ProxyResolverScriptData> script_data_; |
107 DISALLOW_COPY_AND_ASSIGN(V8ExternalStringFromScriptData); | 107 DISALLOW_COPY_AND_ASSIGN(V8ExternalStringFromScriptData); |
108 }; | 108 }; |
109 | 109 |
110 // External string wrapper so V8 can access a string literal. | 110 // External string wrapper so V8 can access a string literal. |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 return 0; | 880 return 0; |
881 | 881 |
882 v8::Locker locked(isolate); | 882 v8::Locker locked(isolate); |
883 v8::Isolate::Scope isolate_scope(isolate); | 883 v8::Isolate::Scope isolate_scope(isolate); |
884 v8::HeapStatistics heap_statistics; | 884 v8::HeapStatistics heap_statistics; |
885 isolate->GetHeapStatistics(&heap_statistics); | 885 isolate->GetHeapStatistics(&heap_statistics); |
886 return heap_statistics.used_heap_size(); | 886 return heap_statistics.used_heap_size(); |
887 } | 887 } |
888 | 888 |
889 } // namespace net | 889 } // namespace net |
OLD | NEW |