| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "media/blink/resource_multibuffer_data_provider.h" | 5 #include "media/blink/resource_multibuffer_data_provider.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 #include <utility> | 8 #include <utility> | 
| 9 | 9 | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 256                                         GetCacheValidUntil(response)); | 256                                         GetCacheValidUntil(response)); | 
| 257 | 257 | 
| 258   uint32_t reasons = GetReasonsForUncacheability(response); | 258   uint32_t reasons = GetReasonsForUncacheability(response); | 
| 259   destination_url_data->set_cacheable(reasons == 0); | 259   destination_url_data->set_cacheable(reasons == 0); | 
| 260   UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0); | 260   UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0); | 
| 261   int shift = 0; | 261   int shift = 0; | 
| 262   int max_enum = base::bits::Log2Ceiling(kMaxReason); | 262   int max_enum = base::bits::Log2Ceiling(kMaxReason); | 
| 263   while (reasons) { | 263   while (reasons) { | 
| 264     DCHECK_LT(shift, max_enum);  // Sanity check. | 264     DCHECK_LT(shift, max_enum);  // Sanity check. | 
| 265     if (reasons & 0x1) { | 265     if (reasons & 0x1) { | 
| 266       UMA_HISTOGRAM_ENUMERATION("Media.UncacheableReason", shift, | 266       // Note: this uses an exact linear UMA to fake an enum UMA, as the actual | 
| 267                                 max_enum);  // PRESUBMIT_IGNORE_UMA_MAX | 267       // enum is a bitmask. | 
|  | 268       UMA_HISTOGRAM_EXACT_LINEAR("Media.UncacheableReason", shift, | 
|  | 269                                  max_enum);  // PRESUBMIT_IGNORE_UMA_MAX | 
| 268     } | 270     } | 
| 269 | 271 | 
| 270     reasons >>= 1; | 272     reasons >>= 1; | 
| 271     ++shift; | 273     ++shift; | 
| 272   } | 274   } | 
| 273 | 275 | 
| 274   // Expected content length can be |kPositionNotSpecified|, in that case | 276   // Expected content length can be |kPositionNotSpecified|, in that case | 
| 275   // |content_length_| is not specified and this is a streaming response. | 277   // |content_length_| is not specified and this is a streaming response. | 
| 276   int64_t content_length = response.expectedContentLength(); | 278   int64_t content_length = response.expectedContentLength(); | 
| 277   bool end_of_file = false; | 279   bool end_of_file = false; | 
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 547   } | 549   } | 
| 548 | 550 | 
| 549   if (byte_pos() != first_byte_position) { | 551   if (byte_pos() != first_byte_position) { | 
| 550     return false; | 552     return false; | 
| 551   } | 553   } | 
| 552 | 554 | 
| 553   return true; | 555   return true; | 
| 554 } | 556 } | 
| 555 | 557 | 
| 556 }  // namespace media | 558 }  // namespace media | 
| OLD | NEW | 
|---|