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

Side by Side Diff: Source/core/fetch/Resource.cpp

Issue 171303003: Make pruning the memory cache when a resource becomes dead consistent in case of no-store (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 } 500 }
501 501
502 bool deleted = deleteIfPossible(); 502 bool deleted = deleteIfPossible();
503 if (!deleted && !hasClients()) { 503 if (!deleted && !hasClients()) {
504 if (inCache()) { 504 if (inCache()) {
505 memoryCache()->removeFromLiveResourcesSize(this); 505 memoryCache()->removeFromLiveResourcesSize(this);
506 memoryCache()->removeFromLiveDecodedResourcesList(this); 506 memoryCache()->removeFromLiveDecodedResourcesList(this);
507 } 507 }
508 if (!m_switchingClientsToRevalidatedResource) 508 if (!m_switchingClientsToRevalidatedResource)
509 allClientsRemoved(); 509 allClientsRemoved();
510 if (response().cacheControlContainsNoStore()) { 510
511 // RFC2616 14.9.2: 511 // RFC2616 14.9.2:
512 // "no-store: ... MUST make a best-effort attempt to remove the info rmation from volatile storage as promptly as possible" 512 // "no-store: ... MUST make a best-effort attempt to remove the informat ion from volatile storage as promptly as possible"
513 // "... History buffers MAY store such responses as part of their no rmal operation." 513 // "... History buffers MAY store such responses as part of their normal operation."
514 // We allow non-secure content to be reused in history, but we do no t allow secure content to be reused. 514 // We allow non-secure content to be reused in history, but we do not al low secure content to be reused.
515 if (url().protocolIs("https")) 515 if (response().cacheControlContainsNoStore() && url().protocolIs("https" )) {
516 memoryCache()->remove(this); 516 memoryCache()->remove(this);
517 memoryCache()->prune();
Nate Chapin 2014/02/18 21:35:54 I think it's safe to call prune(this) after removi
517 } else { 518 } else {
518 memoryCache()->prune(this); 519 memoryCache()->prune(this);
519 } 520 }
520 } 521 }
521 // This object may be dead here. 522 // This object may be dead here.
522 } 523 }
523 524
524 void Resource::allClientsRemoved() 525 void Resource::allClientsRemoved()
525 { 526 {
526 if (!m_loader) 527 if (!m_loader)
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 return "Shader"; 997 return "Shader";
997 case Resource::ImportResource: 998 case Resource::ImportResource:
998 return "ImportResource"; 999 return "ImportResource";
999 } 1000 }
1000 ASSERT_NOT_REACHED(); 1001 ASSERT_NOT_REACHED();
1001 return "Unknown"; 1002 return "Unknown";
1002 } 1003 }
1003 #endif // !LOG_DISABLED 1004 #endif // !LOG_DISABLED
1004 1005
1005 } 1006 }
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