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

Side by Side Diff: net/proxy/proxy_resolver_v8.h

Issue 227233006: Make net use v8 through gin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 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 | Annotate | Revision Log
OLDNEW
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 gin {
14 class IsolateHolder;
15 } // namespace gin
16
13 namespace v8 { 17 namespace v8 {
14 class HeapStatistics; 18 class HeapStatistics;
15 class Isolate; 19 class Isolate;
16 } // namespace v8 20 } // namespace v8
17 21
18 namespace net { 22 namespace net {
19 23
20 // Implementation of ProxyResolver that uses V8 to evaluate PAC scripts. 24 // Implementation of ProxyResolver that uses V8 to evaluate PAC scripts.
21 // 25 //
22 // ---------------------------------------------------------------------------- 26 // ----------------------------------------------------------------------------
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const net::CompletionCallback& /*callback*/, 87 const net::CompletionCallback& /*callback*/,
84 RequestHandle* /*request*/, 88 RequestHandle* /*request*/,
85 const BoundNetLog& net_log) OVERRIDE; 89 const BoundNetLog& net_log) OVERRIDE;
86 virtual void CancelRequest(RequestHandle request) OVERRIDE; 90 virtual void CancelRequest(RequestHandle request) OVERRIDE;
87 virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; 91 virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE;
88 virtual void CancelSetPacScript() OVERRIDE; 92 virtual void CancelSetPacScript() OVERRIDE;
89 virtual int SetPacScript( 93 virtual int SetPacScript(
90 const scoped_refptr<ProxyResolverScriptData>& script_data, 94 const scoped_refptr<ProxyResolverScriptData>& script_data,
91 const net::CompletionCallback& /*callback*/) OVERRIDE; 95 const net::CompletionCallback& /*callback*/) OVERRIDE;
92 96
93 // Remember the default Isolate, must be called from the main thread. This 97 // Create an isolate to use for the proxy resolver.
94 // hack can be removed when the "default Isolate" concept is gone.
95 static void RememberDefaultIsolate();
96
97 #if defined(OS_WIN)
98 // Create an isolate to use for the proxy resolver. Until the "default
99 // Isolate" concept is gone, it is preferable to invoke
100 // RememberDefaultIsolate() as creating a new Isolate in additional to the
101 // default Isolate will waste a few MB of memory and the runtime it took to
102 // create the default Isolate.
103 static void CreateIsolate(); 98 static void CreateIsolate();
104 #endif
105 99
106 static v8::Isolate* GetDefaultIsolate(); 100 static v8::Isolate* GetDefaultIsolate();
107 101
108 // Get total/ued heap memory usage of all v8 instances used by the proxy 102 // Get total/ued heap memory usage of all v8 instances used by the proxy
109 // resolver. 103 // resolver.
110 static size_t GetTotalHeapSize(); 104 static size_t GetTotalHeapSize();
111 static size_t GetUsedHeapSize(); 105 static size_t GetUsedHeapSize();
112 106
113 private: 107 private:
114 static v8::Isolate* g_default_isolate_; 108 static gin::IsolateHolder* g_default_isolate_;
115 109
116 // Context holds the Javascript state for the most recently loaded PAC 110 // Context holds the Javascript state for the most recently loaded PAC
117 // script. It corresponds with the data from the last call to 111 // script. It corresponds with the data from the last call to
118 // SetPacScript(). 112 // SetPacScript().
119 class Context; 113 class Context;
120 114
121 scoped_ptr<Context> context_; 115 scoped_ptr<Context> context_;
122 116
123 JSBindings* js_bindings_; 117 JSBindings* js_bindings_;
124 118
125 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8); 119 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8);
126 }; 120 };
127 121
128 } // namespace net 122 } // namespace net
129 123
130 #endif // NET_PROXY_PROXY_RESOLVER_V8_H_ 124 #endif // NET_PROXY_PROXY_RESOLVER_V8_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698