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

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

Issue 11959029: Make the v8 Isolate used in the proxy resolver explicit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 10 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 v8 {
14 class Isolate;
15 } // namespace v8
16
13 namespace net { 17 namespace net {
14 18
15 // Implementation of ProxyResolver that uses V8 to evaluate PAC scripts. 19 // Implementation of ProxyResolver that uses V8 to evaluate PAC scripts.
16 // 20 //
17 // ---------------------------------------------------------------------------- 21 // ----------------------------------------------------------------------------
18 // !!! Important note on threading model: 22 // !!! Important note on threading model:
19 // ---------------------------------------------------------------------------- 23 // ----------------------------------------------------------------------------
20 // There can be only one instance of V8 running at a time. To enforce this 24 // There can be only one instance of V8 running at a time. To enforce this
21 // constraint, ProxyResolverV8 holds a v8::Locker during execution. Therefore 25 // constraint, ProxyResolverV8 holds a v8::Locker during execution. Therefore
22 // it is OK to run multiple instances of ProxyResolverV8 on different threads, 26 // it is OK to run multiple instances of ProxyResolverV8 on different threads,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 RequestHandle* /*request*/, 82 RequestHandle* /*request*/,
79 const BoundNetLog& net_log) OVERRIDE; 83 const BoundNetLog& net_log) OVERRIDE;
80 virtual void CancelRequest(RequestHandle request) OVERRIDE; 84 virtual void CancelRequest(RequestHandle request) OVERRIDE;
81 virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; 85 virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE;
82 virtual void CancelSetPacScript() OVERRIDE; 86 virtual void CancelSetPacScript() OVERRIDE;
83 virtual void PurgeMemory() OVERRIDE; 87 virtual void PurgeMemory() OVERRIDE;
84 virtual int SetPacScript( 88 virtual int SetPacScript(
85 const scoped_refptr<ProxyResolverScriptData>& script_data, 89 const scoped_refptr<ProxyResolverScriptData>& script_data,
86 const net::CompletionCallback& /*callback*/) OVERRIDE; 90 const net::CompletionCallback& /*callback*/) OVERRIDE;
87 91
92 // Remember the default Isolate, must be called from the main thread. This
93 // hack can be removed when the "default Isolate" concept is gone.
94 static void RememberDefaultIsolate();
95 static v8::Isolate* GetDefaultIsolate();
96
88 private: 97 private:
98 static v8::Isolate* g_default_isolate_;
99
89 // Context holds the Javascript state for the most recently loaded PAC 100 // Context holds the Javascript state for the most recently loaded PAC
90 // script. It corresponds with the data from the last call to 101 // script. It corresponds with the data from the last call to
91 // SetPacScript(). 102 // SetPacScript().
92 class Context; 103 class Context;
93 104
94 scoped_ptr<Context> context_; 105 scoped_ptr<Context> context_;
95 106
96 JSBindings* js_bindings_; 107 JSBindings* js_bindings_;
97 108
98 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8); 109 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8);
99 }; 110 };
100 111
101 } // namespace net 112 } // namespace net
102 113
103 #endif // NET_PROXY_PROXY_RESOLVER_V8_H_ 114 #endif // NET_PROXY_PROXY_RESOLVER_V8_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698