Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Side by Side Diff: webkit/glue/webkitplatformsupport_impl.cc

Issue 14297003: Support concatenated spatialization data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_enabled, name, id, 492 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_enabled, name, id,
493 num_args, arg_names, arg_types, 493 num_args, arg_names, arg_types,
494 arg_values, NULL, flags); 494 arg_values, NULL, flags);
495 } 495 }
496 496
497 497
498 namespace { 498 namespace {
499 499
500 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform, 500 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform,
501 const char* name) { 501 const char* name) {
502 #ifdef IDR_AUDIO_SPATIALIZATION_COMPOSITE
503 if (!strcmp(name, "Composite")) {
504 base::StringPiece resource =
505 platform->GetDataResource(IDR_AUDIO_SPATIALIZATION_COMPOSITE,
506 ui::SCALE_FACTOR_NONE);
507 return WebData(resource.data(), resource.size());
508 }
509 #endif
510
502 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 511 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000
503 const size_t kExpectedSpatializationNameLength = 31; 512 const size_t kExpectedSpatializationNameLength = 31;
504 if (strlen(name) != kExpectedSpatializationNameLength) { 513 if (strlen(name) != kExpectedSpatializationNameLength) {
505 return WebData(); 514 return WebData();
506 } 515 }
507 516
508 // Extract the azimuth and elevation from the resource name. 517 // Extract the azimuth and elevation from the resource name.
509 int azimuth = 0; 518 int azimuth = 0;
510 int elevation = 0; 519 int elevation = 0;
511 int values_parsed = 520 int values_parsed =
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } // namespace 668 } // namespace
660 669
661 WebData WebKitPlatformSupportImpl::loadResource(const char* name) { 670 WebData WebKitPlatformSupportImpl::loadResource(const char* name) {
662 // Some clients will call into this method with an empty |name| when they have 671 // Some clients will call into this method with an empty |name| when they have
663 // optional resources. For example, the PopupMenuChromium code can have icons 672 // optional resources. For example, the PopupMenuChromium code can have icons
664 // for some Autofill items but not for others. 673 // for some Autofill items but not for others.
665 if (!strlen(name)) 674 if (!strlen(name))
666 return WebData(); 675 return WebData();
667 676
668 // Check the name prefix to see if it's an audio resource. 677 // Check the name prefix to see if it's an audio resource.
669 if (StartsWithASCII(name, "IRC_Composite", true)) 678 if (StartsWithASCII(name, "IRC_Composite", true) ||
679 StartsWithASCII(name, "Composite", true))
670 return loadAudioSpatializationResource(this, name); 680 return loadAudioSpatializationResource(this, name);
671 681
672 // TODO(flackr): We should use a better than linear search here, a trie would 682 // TODO(flackr): We should use a better than linear search here, a trie would
673 // be ideal. 683 // be ideal.
674 for (size_t i = 0; i < arraysize(kDataResources); ++i) { 684 for (size_t i = 0; i < arraysize(kDataResources); ++i) {
675 if (!strcmp(name, kDataResources[i].name)) { 685 if (!strcmp(name, kDataResources[i].name)) {
676 base::StringPiece resource = 686 base::StringPiece resource =
677 GetDataResource(kDataResources[i].id, 687 GetDataResource(kDataResources[i].id,
678 kDataResources[i].scale_factor); 688 kDataResources[i].scale_factor);
679 return WebData(resource.data(), resource.size()); 689 return WebData(resource.data(), resource.size());
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 } 994 }
985 995
986 #if defined(OS_ANDROID) 996 #if defined(OS_ANDROID)
987 webkit_media::WebAudioMediaCodecRunner 997 webkit_media::WebAudioMediaCodecRunner
988 WebKitPlatformSupportImpl::GetWebAudioMediaCodecRunner() { 998 WebKitPlatformSupportImpl::GetWebAudioMediaCodecRunner() {
989 return base::Bind(&NullRunWebAudioMediaCodec); 999 return base::Bind(&NullRunWebAudioMediaCodec);
990 } 1000 }
991 #endif 1001 #endif
992 1002
993 } // namespace webkit_glue 1003 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698