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/multi_threaded_proxy_resolver.h" | 5 #include "net/proxy/multi_threaded_proxy_resolver.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 virtual void PurgeMemory() OVERRIDE { | 81 virtual void PurgeMemory() OVERRIDE { |
82 CheckIsOnWorkerThread(); | 82 CheckIsOnWorkerThread(); |
83 ++purge_count_; | 83 ++purge_count_; |
84 } | 84 } |
85 | 85 |
86 int purge_count() const { return purge_count_; } | 86 int purge_count() const { return purge_count_; } |
87 int request_count() const { return request_count_; } | 87 int request_count() const { return request_count_; } |
88 | 88 |
89 const ProxyResolverScriptData* last_script_data() const { | 89 const ProxyResolverScriptData* last_script_data() const { |
90 return last_script_data_; | 90 return last_script_data_.get(); |
91 } | 91 } |
92 | 92 |
93 void SetResolveLatency(base::TimeDelta latency) { | 93 void SetResolveLatency(base::TimeDelta latency) { |
94 resolve_latency_ = latency; | 94 resolve_latency_ = latency; |
95 } | 95 } |
96 | 96 |
97 private: | 97 private: |
98 void CheckIsOnWorkerThread() { | 98 void CheckIsOnWorkerThread() { |
99 // We should be running on the worker thread -- while we don't know the | 99 // We should be running on the worker thread -- while we don't know the |
100 // message loop of MultiThreadedProxyResolver's worker thread, we do | 100 // message loop of MultiThreadedProxyResolver's worker thread, we do |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 // All in all, the first thread should have seen just 1 request. And the | 777 // All in all, the first thread should have seen just 1 request. And the |
778 // second thread 3 requests. | 778 // second thread 3 requests. |
779 ASSERT_EQ(2u, factory->resolvers().size()); | 779 ASSERT_EQ(2u, factory->resolvers().size()); |
780 EXPECT_EQ(1, factory->resolvers()[0]->request_count()); | 780 EXPECT_EQ(1, factory->resolvers()[0]->request_count()); |
781 EXPECT_EQ(3, factory->resolvers()[1]->request_count()); | 781 EXPECT_EQ(3, factory->resolvers()[1]->request_count()); |
782 } | 782 } |
783 | 783 |
784 } // namespace | 784 } // namespace |
785 | 785 |
786 } // namespace net | 786 } // namespace net |
OLD | NEW |