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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/Resource.h

Issue 2746343002: Phase III Step 1: Make ImageResourceContent manage its own ResourceStatus (Closed)
Patch Set: Reflect comments Created 3 years, 7 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
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) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 virtual void OnMemoryDump(WebMemoryDumpLevelOfDetail, 326 virtual void OnMemoryDump(WebMemoryDumpLevelOfDetail,
327 WebProcessMemoryDump*) const; 327 WebProcessMemoryDump*) const;
328 328
329 // If this Resource is ImageResource and has the Lo-Fi response headers or is 329 // If this Resource is ImageResource and has the Lo-Fi response headers or is
330 // a placeholder, reload the full original image with the Lo-Fi state set to 330 // a placeholder, reload the full original image with the Lo-Fi state set to
331 // off and optionally bypassing the cache. 331 // off and optionally bypassing the cache.
332 virtual void ReloadIfLoFiOrPlaceholderImage(ResourceFetcher*, 332 virtual void ReloadIfLoFiOrPlaceholderImage(ResourceFetcher*,
333 ReloadLoFiOrPlaceholderPolicy) {} 333 ReloadLoFiOrPlaceholderPolicy) {}
334 334
335 // Used to notify ImageResourceContent of the start of actual loading.
336 // JavaScript calls or client/observer notifications are disallowed inside
337 // notifyStartLoad().
338 virtual void NotifyStartLoad() {}
339
335 static const char* ResourceTypeToString( 340 static const char* ResourceTypeToString(
336 Type, 341 Type,
337 const AtomicString& fetch_initiator_name); 342 const AtomicString& fetch_initiator_name);
338 343
344 class ProhibitAddRemoveClientInScope : public AutoReset<bool> {
345 public:
346 ProhibitAddRemoveClientInScope(Resource* resource)
347 : AutoReset(&resource->is_add_remove_client_prohibited_, true) {}
348 };
349
350 class RevalidationStartForbiddenScope : public AutoReset<bool> {
351 public:
352 RevalidationStartForbiddenScope(Resource* resource)
353 : AutoReset(&resource->is_revalidation_start_forbidden_, true) {}
354 };
355
339 protected: 356 protected:
340 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); 357 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&);
341 358
342 virtual void CheckNotify(); 359 virtual void CheckNotify();
343 360
344 void MarkClientFinished(ResourceClient*); 361 void MarkClientFinished(ResourceClient*);
345 362
346 virtual bool HasClientsOrObservers() const { 363 virtual bool HasClientsOrObservers() const {
347 return !clients_.IsEmpty() || !clients_awaiting_callback_.IsEmpty() || 364 return !clients_.IsEmpty() || !clients_awaiting_callback_.IsEmpty() ||
348 !finished_clients_.IsEmpty(); 365 !finished_clients_.IsEmpty();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 return clients_; 405 return clients_;
389 } 406 }
390 407
391 void SetCachePolicyBypassingCache(); 408 void SetCachePolicyBypassingCache();
392 void SetPreviewsStateNoTransform(); 409 void SetPreviewsStateNoTransform();
393 void ClearRangeRequestHeader(); 410 void ClearRangeRequestHeader();
394 411
395 SharedBuffer* Data() const { return data_.Get(); } 412 SharedBuffer* Data() const { return data_.Get(); }
396 void ClearData(); 413 void ClearData();
397 414
398 class ProhibitAddRemoveClientInScope : public AutoReset<bool> {
399 public:
400 ProhibitAddRemoveClientInScope(Resource* resource)
401 : AutoReset(&resource->is_add_remove_client_prohibited_, true) {}
402 };
403
404 class RevalidationStartForbiddenScope : public AutoReset<bool> {
405 public:
406 RevalidationStartForbiddenScope(Resource* resource)
407 : AutoReset(&resource->is_revalidation_start_forbidden_, true) {}
408 };
409
410 private: 415 private:
411 class ResourceCallback; 416 class ResourceCallback;
412 class CachedMetadataHandlerImpl; 417 class CachedMetadataHandlerImpl;
413 class ServiceWorkerResponseCachedMetadataHandler; 418 class ServiceWorkerResponseCachedMetadataHandler;
414 419
415 void CancelTimerFired(TimerBase*); 420 void CancelTimerFired(TimerBase*);
416 421
417 void RevalidationSucceeded(const ResourceResponse&); 422 void RevalidationSucceeded(const ResourceResponse&);
418 void RevalidationFailed(); 423 void RevalidationFailed();
419 424
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 }; 504 };
500 505
501 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 506 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
502 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 507 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
503 resource->GetType() == Resource::k##typeName, \ 508 resource->GetType() == Resource::k##typeName, \
504 resource.GetType() == Resource::k##typeName); 509 resource.GetType() == Resource::k##typeName);
505 510
506 } // namespace blink 511 } // namespace blink
507 512
508 #endif 513 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698