Index: media/blink/buffered_resource_loader.cc |
diff --git a/media/blink/buffered_resource_loader.cc b/media/blink/buffered_resource_loader.cc |
index ab3a583079ab9184f3cf41311d48f7a37a714f4d..f742f8920728790cce0581af7a204b559c4004b3 100644 |
--- a/media/blink/buffered_resource_loader.cc |
+++ b/media/blink/buffered_resource_loader.cc |
@@ -4,6 +4,10 @@ |
#include "media/blink/buffered_resource_loader.h" |
+#include <stdint.h> |
+ |
+#include <limits> |
+ |
#include "base/bits.h" |
#include "base/callback_helpers.h" |
#include "base/metrics/histogram.h" |
@@ -94,15 +98,14 @@ static void ComputeTargetBufferWindow(double playback_rate, int bitrate, |
std::swap(*out_forward_capacity, *out_backward_capacity); |
} |
-BufferedResourceLoader::BufferedResourceLoader( |
- const GURL& url, |
- CORSMode cors_mode, |
- int64 first_byte_position, |
- int64 last_byte_position, |
- DeferStrategy strategy, |
- int bitrate, |
- double playback_rate, |
- MediaLog* media_log) |
+BufferedResourceLoader::BufferedResourceLoader(const GURL& url, |
+ CORSMode cors_mode, |
+ int64_t first_byte_position, |
+ int64_t last_byte_position, |
+ DeferStrategy strategy, |
+ int bitrate, |
+ double playback_rate, |
+ MediaLog* media_log) |
: buffer_(kMinBufferCapacity, kMinBufferCapacity), |
loader_failed_(false), |
defer_strategy_(strategy), |
@@ -126,7 +129,6 @@ BufferedResourceLoader::BufferedResourceLoader( |
playback_rate_(playback_rate), |
media_log_(media_log), |
cancel_upon_deferral_(false) { |
- |
// Set the initial capacity of |buffer_| based on |bitrate_| and |
// |playback_rate_|. |
UpdateBufferWindow(); |
@@ -216,11 +218,10 @@ void BufferedResourceLoader::Stop() { |
active_loader_.reset(); |
} |
-void BufferedResourceLoader::Read( |
- int64 position, |
- int read_size, |
- uint8* buffer, |
- const ReadCB& read_cb) { |
+void BufferedResourceLoader::Read(int64_t position, |
+ int read_size, |
+ uint8_t* buffer, |
+ const ReadCB& read_cb) { |
DCHECK(start_cb_.is_null()); |
DCHECK(read_cb_.is_null()); |
DCHECK(!read_cb.is_null()); |
@@ -254,8 +255,8 @@ void BufferedResourceLoader::Read( |
// Make sure |offset_| and |read_position_| does not differ by a large |
// amount. |
- if (read_position_ > offset_ + kint32max || |
- read_position_ < offset_ + kint32min) { |
+ if (read_position_ > offset_ + std::numeric_limits<int32_t>::max() || |
+ read_position_ < offset_ + std::numeric_limits<int32_t>::min()) { |
DoneRead(kCacheMiss, 0); |
return; |
} |
@@ -312,11 +313,11 @@ void BufferedResourceLoader::Read( |
DoneRead(kCacheMiss, 0); |
} |
-int64 BufferedResourceLoader::content_length() { |
+int64_t BufferedResourceLoader::content_length() { |
return content_length_; |
} |
-int64 BufferedResourceLoader::instance_size() { |
+int64_t BufferedResourceLoader::instance_size() { |
return instance_size_; |
} |
@@ -379,7 +380,7 @@ void BufferedResourceLoader::didReceiveResponse( |
if (start_cb_.is_null()) |
return; |
- uint32 reasons = GetReasonsForUncacheability(response); |
+ uint32_t reasons = GetReasonsForUncacheability(response); |
might_be_reused_from_cache_in_future_ = reasons == 0; |
UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0); |
int shift = 0; |
@@ -468,7 +469,7 @@ void BufferedResourceLoader::didReceiveData( |
DCHECK(active_loader_.get()); |
DCHECK_GT(data_length, 0); |
- buffer_.Append(reinterpret_cast<const uint8*>(data), data_length); |
+ buffer_.Append(reinterpret_cast<const uint8_t*>(data), data_length); |
// If there is an active read request, try to fulfill the request. |
if (HasPendingRead() && CanFulfillRead()) |
@@ -715,14 +716,16 @@ void BufferedResourceLoader::ReadInternal() { |
DoneRead(kOk, read); |
} |
-int64 BufferedResourceLoader::first_byte_position() const { |
+int64_t BufferedResourceLoader::first_byte_position() const { |
return first_byte_position_; |
} |
// static |
bool BufferedResourceLoader::ParseContentRange( |
- const std::string& content_range_str, int64* first_byte_position, |
- int64* last_byte_position, int64* instance_size) { |
+ const std::string& content_range_str, |
+ int64_t* first_byte_position, |
+ int64_t* last_byte_position, |
+ int64_t* instance_size) { |
const std::string kUpThroughBytesUnit = "bytes "; |
if (content_range_str.find(kUpThroughBytesUnit) != 0) |
return false; |
@@ -772,7 +775,7 @@ int64_t BufferedResourceLoader::GetMemoryUsage() const { |
bool BufferedResourceLoader::VerifyPartialResponse( |
const WebURLResponse& response) { |
- int64 first_byte_position, last_byte_position, instance_size; |
+ int64_t first_byte_position, last_byte_position, instance_size; |
if (!ParseContentRange(response.httpHeaderField("Content-Range").utf8(), |
&first_byte_position, &last_byte_position, |
&instance_size)) { |