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

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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_enabled, name, id, 487 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_enabled, name, id,
488 num_args, arg_names, arg_types, 488 num_args, arg_names, arg_types,
489 arg_values, NULL, flags); 489 arg_values, NULL, flags);
490 } 490 }
491 491
492 492
493 namespace { 493 namespace {
494 494
495 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform, 495 WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform,
496 const char* name) { 496 const char* name) {
497 #ifdef IDR_AUDIO_SPATIALIZATION_COMPOSITE
498 if (strcmp(name, "Composite") == 0) {
Chris Rogers 2013/04/17 22:33:31 use !strcmp()
499 base::StringPiece resource =
500 platform->GetDataResource(IDR_AUDIO_SPATIALIZATION_COMPOSITE,
501 ui::SCALE_FACTOR_NONE);
502 return WebData(resource.data(), resource.size());
503 }
504 #endif
505
497 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000 506 #ifdef IDR_AUDIO_SPATIALIZATION_T000_P000
Chris Rogers 2013/04/17 22:33:31 I assume that once you switch Blink over to using
Raymond Toy (Google) 2013/04/17 23:32:15 Yes, I will remove that, along with the 240 indivi
498 const size_t kExpectedSpatializationNameLength = 31; 507 const size_t kExpectedSpatializationNameLength = 31;
499 if (strlen(name) != kExpectedSpatializationNameLength) { 508 if (strlen(name) != kExpectedSpatializationNameLength) {
500 return WebData(); 509 return WebData();
501 } 510 }
502 511
503 // Extract the azimuth and elevation from the resource name. 512 // Extract the azimuth and elevation from the resource name.
504 int azimuth = 0; 513 int azimuth = 0;
505 int elevation = 0; 514 int elevation = 0;
506 int values_parsed = 515 int values_parsed =
507 sscanf(name, "IRC_Composite_C_R0195_T%3d_P%3d", &azimuth, &elevation); 516 sscanf(name, "IRC_Composite_C_R0195_T%3d_P%3d", &azimuth, &elevation);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 } // namespace 663 } // namespace
655 664
656 WebData WebKitPlatformSupportImpl::loadResource(const char* name) { 665 WebData WebKitPlatformSupportImpl::loadResource(const char* name) {
657 // Some clients will call into this method with an empty |name| when they have 666 // Some clients will call into this method with an empty |name| when they have
658 // optional resources. For example, the PopupMenuChromium code can have icons 667 // optional resources. For example, the PopupMenuChromium code can have icons
659 // for some Autofill items but not for others. 668 // for some Autofill items but not for others.
660 if (!strlen(name)) 669 if (!strlen(name))
661 return WebData(); 670 return WebData();
662 671
663 // Check the name prefix to see if it's an audio resource. 672 // Check the name prefix to see if it's an audio resource.
664 if (StartsWithASCII(name, "IRC_Composite", true)) 673 if (StartsWithASCII(name, "IRC_Composite", true) ||
674 StartsWithASCII(name, "Composite", true))
Chris Rogers 2013/04/17 22:33:31 I assume once Blink switches to the single file th
Raymond Toy (Google) 2013/04/17 23:32:15 Yes
665 return loadAudioSpatializationResource(this, name); 675 return loadAudioSpatializationResource(this, name);
666 676
667 // TODO(flackr): We should use a better than linear search here, a trie would 677 // TODO(flackr): We should use a better than linear search here, a trie would
668 // be ideal. 678 // be ideal.
669 for (size_t i = 0; i < arraysize(kDataResources); ++i) { 679 for (size_t i = 0; i < arraysize(kDataResources); ++i) {
670 if (!strcmp(name, kDataResources[i].name)) { 680 if (!strcmp(name, kDataResources[i].name)) {
671 base::StringPiece resource = 681 base::StringPiece resource =
672 GetDataResource(kDataResources[i].id, 682 GetDataResource(kDataResources[i].id,
673 kDataResources[i].scale_factor); 683 kDataResources[i].scale_factor);
674 return WebData(resource.data(), resource.size()); 684 return WebData(resource.data(), resource.size());
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } 989 }
980 990
981 #if defined(OS_ANDROID) 991 #if defined(OS_ANDROID)
982 webkit_media::WebAudioMediaCodecRunner 992 webkit_media::WebAudioMediaCodecRunner
983 WebKitPlatformSupportImpl::GetWebAudioMediaCodecRunner() { 993 WebKitPlatformSupportImpl::GetWebAudioMediaCodecRunner() {
984 return base::Bind(&NullRunWebAudioMediaCodec); 994 return base::Bind(&NullRunWebAudioMediaCodec);
985 } 995 }
986 #endif 996 #endif
987 997
988 } // namespace webkit_glue 998 } // 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