OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/android/media_info_loader.h" | 5 #include "content/renderer/media/android/media_info_loader.h" |
6 | 6 |
7 #include "base/bits.h" | 7 #include "base/bits.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "third_party/WebKit/public/platform/WebURLError.h" | 10 #include "third_party/WebKit/public/platform/WebURLError.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 static const int kHttpOK = 200; | 24 static const int kHttpOK = 200; |
25 | 25 |
26 MediaInfoLoader::MediaInfoLoader( | 26 MediaInfoLoader::MediaInfoLoader( |
27 const GURL& url, | 27 const GURL& url, |
28 blink::WebMediaPlayer::CORSMode cors_mode, | 28 blink::WebMediaPlayer::CORSMode cors_mode, |
29 const ReadyCB& ready_cb) | 29 const ReadyCB& ready_cb) |
30 : loader_failed_(false), | 30 : loader_failed_(false), |
31 url_(url), | 31 url_(url), |
32 cors_mode_(cors_mode), | 32 cors_mode_(cors_mode), |
33 single_origin_(true), | 33 // TODO(qinmin): The url might be redirected when android media player |
34 // requests the stream. As a result, we cannot guarantee there is only | |
35 // a single origin. Set this back to true when b/12573548 is fixed. | |
scherkus (not reviewing)
2014/04/24 17:18:33
can we link to the crbug.com as well?
qinmin
2014/04/24 17:40:51
Done.
| |
36 single_origin_(false), | |
34 ready_cb_(ready_cb) {} | 37 ready_cb_(ready_cb) {} |
35 | 38 |
36 MediaInfoLoader::~MediaInfoLoader() {} | 39 MediaInfoLoader::~MediaInfoLoader() {} |
37 | 40 |
38 void MediaInfoLoader::Start(blink::WebFrame* frame) { | 41 void MediaInfoLoader::Start(blink::WebFrame* frame) { |
39 // Make sure we have not started. | 42 // Make sure we have not started. |
40 DCHECK(!ready_cb_.is_null()); | 43 DCHECK(!ready_cb_.is_null()); |
41 CHECK(frame); | 44 CHECK(frame); |
42 | 45 |
43 start_time_ = base::TimeTicks::Now(); | 46 start_time_ = base::TimeTicks::Now(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 | 187 |
185 void MediaInfoLoader::DidBecomeReady(Status status) { | 188 void MediaInfoLoader::DidBecomeReady(Status status) { |
186 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", | 189 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", |
187 base::TimeTicks::Now() - start_time_); | 190 base::TimeTicks::Now() - start_time_); |
188 active_loader_.reset(); | 191 active_loader_.reset(); |
189 if (!ready_cb_.is_null()) | 192 if (!ready_cb_.is_null()) |
190 base::ResetAndReturn(&ready_cb_).Run(status); | 193 base::ResetAndReturn(&ready_cb_).Run(status); |
191 } | 194 } |
192 | 195 |
193 } // namespace content | 196 } // namespace content |
OLD | NEW |