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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 | 357 |
358 void WebMediaPlayerImpl::setVisible(bool visible) { | 358 void WebMediaPlayerImpl::setVisible(bool visible) { |
359 DCHECK_EQ(main_loop_, MessageLoop::current()); | 359 DCHECK_EQ(main_loop_, MessageLoop::current()); |
360 | 360 |
361 // TODO(hclam): add appropriate method call when pipeline has it implemented. | 361 // TODO(hclam): add appropriate method call when pipeline has it implemented. |
362 return; | 362 return; |
363 } | 363 } |
364 | 364 |
365 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ | 365 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ |
366 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayer::webkit_name) == \ | 366 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayer::webkit_name) == \ |
367 static_cast<int>(media::chromium_name), \ | 367 static_cast<int>(webkit_media::chromium_name), \ |
368 mismatching_enums) | 368 mismatching_enums) |
369 COMPILE_ASSERT_MATCHING_ENUM(None, NONE); | 369 COMPILE_ASSERT_MATCHING_ENUM(None, NONE); |
370 COMPILE_ASSERT_MATCHING_ENUM(MetaData, METADATA); | 370 COMPILE_ASSERT_MATCHING_ENUM(MetaData, METADATA); |
371 COMPILE_ASSERT_MATCHING_ENUM(Auto, AUTO); | 371 COMPILE_ASSERT_MATCHING_ENUM(Auto, AUTO); |
372 | 372 |
373 void WebMediaPlayerImpl::setPreload(WebKit::WebMediaPlayer::Preload preload) { | 373 void WebMediaPlayerImpl::setPreload(WebKit::WebMediaPlayer::Preload preload) { |
374 DCHECK_EQ(main_loop_, MessageLoop::current()); | 374 DCHECK_EQ(main_loop_, MessageLoop::current()); |
375 | 375 |
376 pipeline_->SetPreload(static_cast<media::Preload>(preload)); | 376 if (proxy_ && proxy_->data_source()) { |
377 // XXX: Why do I need to use webkit_media:: prefix? clang complains! | |
scherkus (not reviewing)
2012/03/27 02:52:06
note: I'm investigating this
| |
378 proxy_->data_source()->SetPreload( | |
379 static_cast<webkit_media::Preload>(preload)); | |
380 } | |
377 } | 381 } |
378 | 382 |
379 bool WebMediaPlayerImpl::totalBytesKnown() { | 383 bool WebMediaPlayerImpl::totalBytesKnown() { |
380 DCHECK_EQ(main_loop_, MessageLoop::current()); | 384 DCHECK_EQ(main_loop_, MessageLoop::current()); |
381 | 385 |
382 return pipeline_->GetTotalBytes() != 0; | 386 return pipeline_->GetTotalBytes() != 0; |
383 } | 387 } |
384 | 388 |
385 bool WebMediaPlayerImpl::hasVideo() const { | 389 bool WebMediaPlayerImpl::hasVideo() const { |
386 DCHECK_EQ(main_loop_, MessageLoop::current()); | 390 DCHECK_EQ(main_loop_, MessageLoop::current()); |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 return audio_source_provider_; | 895 return audio_source_provider_; |
892 } | 896 } |
893 | 897 |
894 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 898 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
895 DCHECK_EQ(main_loop_, MessageLoop::current()); | 899 DCHECK_EQ(main_loop_, MessageLoop::current()); |
896 incremented_externally_allocated_memory_ = true; | 900 incremented_externally_allocated_memory_ = true; |
897 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 901 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
898 } | 902 } |
899 | 903 |
900 } // namespace webkit_media | 904 } // namespace webkit_media |
OLD | NEW |