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/glue/webkitplatformsupport_impl.h" | 5 #include "webkit/glue/webkitplatformsupport_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 // How long the cached value should remain valid. | 115 // How long the cached value should remain valid. |
116 base::TimeDelta cache_valid_time_; | 116 base::TimeDelta cache_valid_time_; |
117 | 117 |
118 // The last time the cached value was updated. | 118 // The last time the cached value was updated. |
119 base::Time last_updated_time_; | 119 base::Time last_updated_time_; |
120 | 120 |
121 base::Lock lock_; | 121 base::Lock lock_; |
122 }; | 122 }; |
123 | 123 |
| 124 #if defined(OS_ANDROID) |
| 125 void NullRunWebAudioMediaCodec( |
| 126 base::SharedMemoryHandle encoded_data_handle, |
| 127 base::FileDescriptor pcm_output) { |
| 128 } |
| 129 #endif |
| 130 |
124 } // anonymous namespace | 131 } // anonymous namespace |
125 | 132 |
126 namespace webkit_glue { | 133 namespace webkit_glue { |
127 | 134 |
128 static int ToMessageID(WebLocalizedString::Name name) { | 135 static int ToMessageID(WebLocalizedString::Name name) { |
129 switch (name) { | 136 switch (name) { |
130 case WebLocalizedString::AXAMPMFieldText: | 137 case WebLocalizedString::AXAMPMFieldText: |
131 return IDS_AX_AM_PM_FIELD_TEXT; | 138 return IDS_AX_AM_PM_FIELD_TEXT; |
132 case WebLocalizedString::AXButtonActionVerb: | 139 case WebLocalizedString::AXButtonActionVerb: |
133 return IDS_AX_BUTTON_ACTION_VERB; | 140 return IDS_AX_BUTTON_ACTION_VERB; |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 } | 675 } |
669 } | 676 } |
670 | 677 |
671 NOTREACHED() << "Unknown image resource " << name; | 678 NOTREACHED() << "Unknown image resource " << name; |
672 return WebData(); | 679 return WebData(); |
673 } | 680 } |
674 | 681 |
675 bool WebKitPlatformSupportImpl::loadAudioResource( | 682 bool WebKitPlatformSupportImpl::loadAudioResource( |
676 WebKit::WebAudioBus* destination_bus, const char* audio_file_data, | 683 WebKit::WebAudioBus* destination_bus, const char* audio_file_data, |
677 size_t data_size, double sample_rate) { | 684 size_t data_size, double sample_rate) { |
| 685 #if !defined(OS_ANDROID) |
678 return webkit_media::DecodeAudioFileData(destination_bus, | 686 return webkit_media::DecodeAudioFileData(destination_bus, |
679 audio_file_data, | 687 audio_file_data, |
680 data_size, | 688 data_size, |
681 sample_rate); | 689 sample_rate); |
| 690 #else |
| 691 webkit_media::WebAudioMediaCodecRunner runner = GetWebAudioMediaCodecRunner(); |
| 692 return webkit_media::DecodeAudioFileData( |
| 693 destination_bus, |
| 694 audio_file_data, |
| 695 data_size, |
| 696 sample_rate, |
| 697 runner); |
| 698 #endif |
682 } | 699 } |
683 | 700 |
684 WebString WebKitPlatformSupportImpl::queryLocalizedString( | 701 WebString WebKitPlatformSupportImpl::queryLocalizedString( |
685 WebLocalizedString::Name name) { | 702 WebLocalizedString::Name name) { |
686 int message_id = ToMessageID(name); | 703 int message_id = ToMessageID(name); |
687 if (message_id < 0) | 704 if (message_id < 0) |
688 return WebString(); | 705 return WebString(); |
689 return GetLocalizedString(message_id); | 706 return GetLocalizedString(message_id); |
690 } | 707 } |
691 | 708 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 WebKitPlatformSupportImpl::allocateAndLockDiscardableMemory(size_t bytes) { | 971 WebKitPlatformSupportImpl::allocateAndLockDiscardableMemory(size_t bytes) { |
955 if (!base::DiscardableMemory::Supported()) | 972 if (!base::DiscardableMemory::Supported()) |
956 return NULL; | 973 return NULL; |
957 scoped_ptr<WebDiscardableMemoryImpl> discardable( | 974 scoped_ptr<WebDiscardableMemoryImpl> discardable( |
958 new WebDiscardableMemoryImpl()); | 975 new WebDiscardableMemoryImpl()); |
959 if (discardable->InitializeAndLock(bytes)) | 976 if (discardable->InitializeAndLock(bytes)) |
960 return discardable.release(); | 977 return discardable.release(); |
961 return NULL; | 978 return NULL; |
962 } | 979 } |
963 | 980 |
| 981 #if defined(OS_ANDROID) |
| 982 webkit_media::WebAudioMediaCodecRunner |
| 983 WebKitPlatformSupportImpl::GetWebAudioMediaCodecRunner() { |
| 984 return base::Bind(&NullRunWebAudioMediaCodec); |
| 985 } |
| 986 #endif |
964 | 987 |
965 } // namespace webkit_glue | 988 } // namespace webkit_glue |
OLD | NEW |