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

Side by Side Diff: third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp

Issue 1437823003: MemoryCacheTest: tidy up task's Resource reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 ASSERT_GT(m_live->decodedSize(), 0u); 226 ASSERT_GT(m_live->decodedSize(), 0u);
227 227
228 memoryCache()->prune(); // Dead resources are pruned immediately 228 memoryCache()->prune(); // Dead resources are pruned immediately
229 ASSERT_EQ(m_dead->size(), memoryCache()->deadSize()); 229 ASSERT_EQ(m_dead->size(), memoryCache()->deadSize());
230 ASSERT_EQ(m_live->size(), memoryCache()->liveSize()); 230 ASSERT_EQ(m_live->size(), memoryCache()->liveSize());
231 ASSERT_GT(m_live->decodedSize(), 0u); 231 ASSERT_GT(m_live->decodedSize(), 0u);
232 } 232 }
233 233
234 private: 234 private:
235 ResourcePtr<Resource> m_live; 235 ResourcePtr<Resource> m_live;
236 Resource* m_dead; 236 RawPtrWillBePersistent<Resource> m_dead;
237 }; 237 };
238 238
239 class Task2 : public WebTaskRunner::Task { 239 class Task2 : public WebTaskRunner::Task {
240 public: 240 public:
241 Task2(unsigned liveSizeWithoutDecode) 241 Task2(unsigned liveSizeWithoutDecode)
242 : m_liveSizeWithoutDecode(liveSizeWithoutDecode) { } 242 : m_liveSizeWithoutDecode(liveSizeWithoutDecode) { }
243 243
244 void run() override 244 void run() override
245 { 245 {
246 // Next task: now, the live resource was evicted. 246 // Next task: now, the live resource was evicted.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 561
562 WillBeHeapVector<RawPtrWillBeMember<Resource>> resources = memoryCache()->re sourcesForURL(url); 562 WillBeHeapVector<RawPtrWillBeMember<Resource>> resources = memoryCache()->re sourcesForURL(url);
563 EXPECT_EQ(2u, resources.size()); 563 EXPECT_EQ(2u, resources.size());
564 564
565 memoryCache()->evictResources(); 565 memoryCache()->evictResources();
566 EXPECT_FALSE(memoryCache()->contains(resource1.get())); 566 EXPECT_FALSE(memoryCache()->contains(resource1.get()));
567 EXPECT_FALSE(memoryCache()->contains(resource3.get())); 567 EXPECT_FALSE(memoryCache()->contains(resource3.get()));
568 } 568 }
569 569
570 } // namespace 570 } // 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