| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/media/webmediaplayer_impl.h" | 5 #include "webkit/media/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 return seeking_; | 473 return seeking_; |
| 474 } | 474 } |
| 475 | 475 |
| 476 float WebMediaPlayerImpl::duration() const { | 476 float WebMediaPlayerImpl::duration() const { |
| 477 DCHECK_EQ(main_loop_, MessageLoop::current()); | 477 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 478 | 478 |
| 479 base::TimeDelta duration = pipeline_->GetMediaDuration(); | 479 base::TimeDelta duration = pipeline_->GetMediaDuration(); |
| 480 | 480 |
| 481 // Return positive infinity if the resource is unbounded. | 481 // Return positive infinity if the resource is unbounded. |
| 482 // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-
media-duration | 482 // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-
media-duration |
| 483 if (duration == media::kInfiniteDuration) | 483 if (duration == media::kInfiniteDuration()) |
| 484 return std::numeric_limits<float>::infinity(); | 484 return std::numeric_limits<float>::infinity(); |
| 485 | 485 |
| 486 return static_cast<float>(duration.InSecondsF()); | 486 return static_cast<float>(duration.InSecondsF()); |
| 487 } | 487 } |
| 488 | 488 |
| 489 float WebMediaPlayerImpl::currentTime() const { | 489 float WebMediaPlayerImpl::currentTime() const { |
| 490 DCHECK_EQ(main_loop_, MessageLoop::current()); | 490 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 491 if (paused_) | 491 if (paused_) |
| 492 return static_cast<float>(paused_time_.InSecondsF()); | 492 return static_cast<float>(paused_time_.InSecondsF()); |
| 493 return static_cast<float>(pipeline_->GetCurrentTime().InSecondsF()); | 493 return static_cast<float>(pipeline_->GetCurrentTime().InSecondsF()); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 return audio_source_provider_; | 916 return audio_source_provider_; |
| 917 } | 917 } |
| 918 | 918 |
| 919 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 919 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 920 DCHECK_EQ(main_loop_, MessageLoop::current()); | 920 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 921 incremented_externally_allocated_memory_ = true; | 921 incremented_externally_allocated_memory_ = true; |
| 922 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 922 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 923 } | 923 } |
| 924 | 924 |
| 925 } // namespace webkit_media | 925 } // namespace webkit_media |
| OLD | NEW |