OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_PROXY_PROXY_RESOLVER_V8_H_ | 5 #ifndef NET_PROXY_PROXY_RESOLVER_V8_H_ |
6 #define NET_PROXY_PROXY_RESOLVER_V8_H_ | 6 #define NET_PROXY_PROXY_RESOLVER_V8_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 #include "net/proxy/proxy_resolver.h" | 11 #include "net/proxy/proxy_resolver.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
| 14 class HeapStatistics; |
14 class Isolate; | 15 class Isolate; |
15 } // namespace v8 | 16 } // namespace v8 |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 // Implementation of ProxyResolver that uses V8 to evaluate PAC scripts. | 20 // Implementation of ProxyResolver that uses V8 to evaluate PAC scripts. |
20 // | 21 // |
21 // ---------------------------------------------------------------------------- | 22 // ---------------------------------------------------------------------------- |
22 // !!! Important note on threading model: | 23 // !!! Important note on threading model: |
23 // ---------------------------------------------------------------------------- | 24 // ---------------------------------------------------------------------------- |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 virtual void PurgeMemory() OVERRIDE; | 89 virtual void PurgeMemory() OVERRIDE; |
89 virtual int SetPacScript( | 90 virtual int SetPacScript( |
90 const scoped_refptr<ProxyResolverScriptData>& script_data, | 91 const scoped_refptr<ProxyResolverScriptData>& script_data, |
91 const net::CompletionCallback& /*callback*/) OVERRIDE; | 92 const net::CompletionCallback& /*callback*/) OVERRIDE; |
92 | 93 |
93 // Remember the default Isolate, must be called from the main thread. This | 94 // Remember the default Isolate, must be called from the main thread. This |
94 // hack can be removed when the "default Isolate" concept is gone. | 95 // hack can be removed when the "default Isolate" concept is gone. |
95 static void RememberDefaultIsolate(); | 96 static void RememberDefaultIsolate(); |
96 static v8::Isolate* GetDefaultIsolate(); | 97 static v8::Isolate* GetDefaultIsolate(); |
97 | 98 |
| 99 // Get total/ued heap memory usage of all v8 instances used by the proxy |
| 100 // resolver. |
| 101 static size_t GetTotalHeapSize(); |
| 102 static size_t GetUsedHeapSize(); |
| 103 |
98 private: | 104 private: |
99 static v8::Isolate* g_default_isolate_; | 105 static v8::Isolate* g_default_isolate_; |
100 | 106 |
101 // Context holds the Javascript state for the most recently loaded PAC | 107 // Context holds the Javascript state for the most recently loaded PAC |
102 // script. It corresponds with the data from the last call to | 108 // script. It corresponds with the data from the last call to |
103 // SetPacScript(). | 109 // SetPacScript(). |
104 class Context; | 110 class Context; |
105 | 111 |
106 scoped_ptr<Context> context_; | 112 scoped_ptr<Context> context_; |
107 | 113 |
108 JSBindings* js_bindings_; | 114 JSBindings* js_bindings_; |
109 | 115 |
110 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8); | 116 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8); |
111 }; | 117 }; |
112 | 118 |
113 } // namespace net | 119 } // namespace net |
114 | 120 |
115 #endif // NET_PROXY_PROXY_RESOLVER_V8_H_ | 121 #endif // NET_PROXY_PROXY_RESOLVER_V8_H_ |
OLD | NEW |