OLD | NEW |
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 response_.SetEncodedDataLength(value); | 300 response_.SetEncodedDataLength(value); |
301 } | 301 } |
302 void SetEncodedBodyLength(int value) { | 302 void SetEncodedBodyLength(int value) { |
303 response_.SetEncodedBodyLength(value); | 303 response_.SetEncodedBodyLength(value); |
304 } | 304 } |
305 void SetDecodedBodyLength(int value) { | 305 void SetDecodedBodyLength(int value) { |
306 response_.SetDecodedBodyLength(value); | 306 response_.SetDecodedBodyLength(value); |
307 } | 307 } |
308 | 308 |
309 virtual bool CanReuse(const FetchParameters&) const { return true; } | 309 virtual bool CanReuse(const FetchParameters&) const { return true; } |
| 310 virtual bool IsShareable() const { |
| 311 // MemoryCache works only on the main thread, so we don't add a resource |
| 312 // on another thread. |
| 313 return IsMainThread() && options_.data_buffering_policy != kDoNotBufferData; |
| 314 } |
310 | 315 |
311 // If cache-aware loading is activated, this callback is called when the first | 316 // If cache-aware loading is activated, this callback is called when the first |
312 // disk-cache-only request failed due to cache miss. After this callback, | 317 // disk-cache-only request failed due to cache miss. After this callback, |
313 // cache-aware loading is deactivated and a reload with original request will | 318 // cache-aware loading is deactivated and a reload with original request will |
314 // be triggered right away in ResourceLoader. | 319 // be triggered right away in ResourceLoader. |
315 virtual void WillReloadAfterDiskCacheMiss() {} | 320 virtual void WillReloadAfterDiskCacheMiss() {} |
316 | 321 |
317 // TODO(shaochuan): This is for saving back the actual ResourceRequest sent | 322 // TODO(shaochuan): This is for saving back the actual ResourceRequest sent |
318 // in ResourceFetcher::startLoad() for retry in cache-aware loading, remove | 323 // in ResourceFetcher::startLoad() for retry in cache-aware loading, remove |
319 // once ResourceRequest is not modified in startLoad(). crbug.com/632580 | 324 // once ResourceRequest is not modified in startLoad(). crbug.com/632580 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 }; | 510 }; |
506 | 511 |
507 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 512 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
508 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ | 513 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ |
509 resource->GetType() == Resource::k##typeName, \ | 514 resource->GetType() == Resource::k##typeName, \ |
510 resource.GetType() == Resource::k##typeName); | 515 resource.GetType() == Resource::k##typeName); |
511 | 516 |
512 } // namespace blink | 517 } // namespace blink |
513 | 518 |
514 #endif | 519 #endif |
OLD | NEW |