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

Side by Side Diff: net/disk_cache/disk_cache_perftest.cc

Issue 2622013002: Simple Cache Perftests: properly restore FD limit. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <limits> 5 #include <limits>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 class DiskCachePerfTest : public DiskCacheTestWithCache { 56 class DiskCachePerfTest : public DiskCacheTestWithCache {
57 public: 57 public:
58 DiskCachePerfTest() : saved_fd_limit_(MaybeGetMaxFds()) { 58 DiskCachePerfTest() : saved_fd_limit_(MaybeGetMaxFds()) {
59 if (saved_fd_limit_ < kFdLimitForCacheTests) 59 if (saved_fd_limit_ < kFdLimitForCacheTests)
60 MaybeSetFdLimit(kFdLimitForCacheTests); 60 MaybeSetFdLimit(kFdLimitForCacheTests);
61 } 61 }
62 62
63 ~DiskCachePerfTest() override { 63 ~DiskCachePerfTest() override {
64 if (saved_fd_limit_ < kFdLimitForCacheTests) 64 if (saved_fd_limit_ < kFdLimitForCacheTests)
65 MaybeSetFdLimit(kFdLimitForCacheTests); 65 MaybeSetFdLimit(saved_fd_limit_);
66 } 66 }
67 67
68 protected: 68 protected:
69 enum class WhatToRead { 69 enum class WhatToRead {
70 HEADERS_ONLY, 70 HEADERS_ONLY,
71 HEADERS_AND_BODY, 71 HEADERS_AND_BODY,
72 }; 72 };
73 73
74 // Helper methods for constructing tests. 74 // Helper methods for constructing tests.
75 bool TimeWrite(); 75 bool TimeWrite();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 files.DeleteBlock(address[entry], false); 299 files.DeleteBlock(address[entry], false);
300 EXPECT_TRUE( 300 EXPECT_TRUE(
301 files.CreateBlock(disk_cache::RANKINGS, block_size, &address[entry])); 301 files.CreateBlock(disk_cache::RANKINGS, block_size, &address[entry]));
302 } 302 }
303 303
304 timer2.Done(); 304 timer2.Done();
305 base::RunLoop().RunUntilIdle(); 305 base::RunLoop().RunUntilIdle();
306 } 306 }
307 307
308 } // namespace 308 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698