OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_tracing.h" | 5 #include "net/proxy/proxy_resolver_v8_tracing.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // under the tracing optimization. It is not expected to hit this normally. | 52 // under the tracing optimization. It is not expected to hit this normally. |
53 const size_t kMaxUniqueResolveDnsPerExec = 20; | 53 const size_t kMaxUniqueResolveDnsPerExec = 20; |
54 | 54 |
55 // Approximate number of bytes to use for buffering alerts() and errors. | 55 // Approximate number of bytes to use for buffering alerts() and errors. |
56 // This is a failsafe in case repeated executions of the script causes | 56 // This is a failsafe in case repeated executions of the script causes |
57 // too much memory bloat. It is not expected for well behaved scripts to | 57 // too much memory bloat. It is not expected for well behaved scripts to |
58 // hit this. (In fact normal scripts should not even have alerts() or errors). | 58 // hit this. (In fact normal scripts should not even have alerts() or errors). |
59 const size_t kMaxAlertsAndErrorsBytes = 2048; | 59 const size_t kMaxAlertsAndErrorsBytes = 2048; |
60 | 60 |
61 // Returns event parameters for a PAC error message (line number + message). | 61 // Returns event parameters for a PAC error message (line number + message). |
62 base::Value* NetLogErrorCallback(int line_number, | 62 scoped_ptr<base::Value> NetLogErrorCallback( |
63 const base::string16* message, | 63 int line_number, |
64 NetLogCaptureMode /* capture_mode */) { | 64 const base::string16* message, |
65 base::DictionaryValue* dict = new base::DictionaryValue(); | 65 NetLogCaptureMode /* capture_mode */) { |
| 66 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
66 dict->SetInteger("line_number", line_number); | 67 dict->SetInteger("line_number", line_number); |
67 dict->SetString("message", *message); | 68 dict->SetString("message", *message); |
68 return dict; | 69 return dict.Pass(); |
69 } | 70 } |
70 | 71 |
71 // The Job class is responsible for executing GetProxyForURL() and | 72 // The Job class is responsible for executing GetProxyForURL() and |
72 // creating ProxyResolverV8 instances, since both of these operations share | 73 // creating ProxyResolverV8 instances, since both of these operations share |
73 // similar code. | 74 // similar code. |
74 // | 75 // |
75 // The DNS for these operations can operate in either blocking or | 76 // The DNS for these operations can operate in either blocking or |
76 // non-blocking mode. Blocking mode is used as a fallback when the PAC script | 77 // non-blocking mode. Blocking mode is used as a fallback when the PAC script |
77 // seems to be misbehaving under the tracing optimization. | 78 // seems to be misbehaving under the tracing optimization. |
78 // | 79 // |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 return ERR_IO_PENDING; | 1192 return ERR_IO_PENDING; |
1192 } | 1193 } |
1193 | 1194 |
1194 void ProxyResolverFactoryV8Tracing::RemoveJob( | 1195 void ProxyResolverFactoryV8Tracing::RemoveJob( |
1195 ProxyResolverFactoryV8Tracing::CreateJob* job) { | 1196 ProxyResolverFactoryV8Tracing::CreateJob* job) { |
1196 size_t erased = jobs_.erase(job); | 1197 size_t erased = jobs_.erase(job); |
1197 DCHECK_EQ(1u, erased); | 1198 DCHECK_EQ(1u, erased); |
1198 } | 1199 } |
1199 | 1200 |
1200 } // namespace net | 1201 } // namespace net |
OLD | NEW |