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

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

Issue 1304063016: Refactor the API for setting dynamic resource load priorities (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | Source/core/fetch/ResourceClient.h » ('j') | 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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 static const int kAverageClientsHashMapSize = 384; 947 static const int kAverageClientsHashMapSize = 384;
948 return sizeof(Resource) + m_response.memoryUsage() + kAverageClientsHashMapS ize + m_resourceRequest.url().string().length() * 2; 948 return sizeof(Resource) + m_response.memoryUsage() + kAverageClientsHashMapS ize + m_resourceRequest.url().string().length() * 2;
949 } 949 }
950 950
951 void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPri orityValue) 951 void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPri orityValue)
952 { 952 {
953 if (m_loader) 953 if (m_loader)
954 m_loader->didChangePriority(loadPriority, intraPriorityValue); 954 m_loader->didChangePriority(loadPriority, intraPriorityValue);
955 } 955 }
956 956
957 ResourcePriority Resource::priorityFromClients()
958 {
959 ResourcePriority priority;
960 ResourceClientWalker<ResourceClient> w(m_clients);
961 while (ResourceClient* c = w.next()) {
962 ResourcePriority nextPriority = c->updatePriority(this);
963 if (nextPriority.visibility == ResourcePriority::NotVisible)
964 continue;
965 priority.visibility = ResourcePriority::Visible;
966 priority.intraPriorityValue += nextPriority.intraPriorityValue;
967 }
968 return priority;
969 }
970
957 Resource::ResourceCallback* Resource::ResourceCallback::callbackHandler() 971 Resource::ResourceCallback* Resource::ResourceCallback::callbackHandler()
958 { 972 {
959 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ResourceCallback>, callbackHandle r, (adoptPtrWillBeNoop(new ResourceCallback))); 973 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ResourceCallback>, callbackHandle r, (adoptPtrWillBeNoop(new ResourceCallback)));
960 return callbackHandler.get(); 974 return callbackHandler.get();
961 } 975 }
962 976
963 DEFINE_TRACE(Resource::ResourceCallback) 977 DEFINE_TRACE(Resource::ResourceCallback)
964 { 978 {
965 #if ENABLE(OILPAN) 979 #if ENABLE(OILPAN)
966 visitor->trace(m_resourcesWithPendingClients); 980 visitor->trace(m_resourcesWithPendingClients);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 return "ImportResource"; 1116 return "ImportResource";
1103 case Resource::Media: 1117 case Resource::Media:
1104 return "Media"; 1118 return "Media";
1105 } 1119 }
1106 ASSERT_NOT_REACHED(); 1120 ASSERT_NOT_REACHED();
1107 return "Unknown"; 1121 return "Unknown";
1108 } 1122 }
1109 #endif // !LOG_DISABLED 1123 #endif // !LOG_DISABLED
1110 1124
1111 } // namespace blink 1125 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | Source/core/fetch/ResourceClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698