| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |