Commit b4d021f9 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

WebAudio: Remove the code for "IRC_Composite_C_R0195_*" resources

Now IDR_AUDIO_SPATIALIZATION_T000_P000 is not defined
on any platforms.

This CL has no behavior changes.

Bug: 983396
Change-Id: Ibb62eb16c949810ce7124f96db937d7072a8538a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1760577Reviewed-by: default avatarHongchan Choi <hongchan@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688374}
parent 21416b68
......@@ -351,63 +351,6 @@ int ToMessageID(WebLocalizedString::Name name) {
return -1;
}
WebData loadAudioSpatializationResource(const char* name) {
#ifdef IDR_AUDIO_SPATIALIZATION_COMPOSITE
if (!strcmp(name, "Composite")) {
base::StringPiece resource = GetContentClient()->GetDataResource(
IDR_AUDIO_SPATIALIZATION_COMPOSITE, ui::SCALE_FACTOR_NONE);
return WebData(resource.data(), resource.size());
}
#endif
#ifdef IDR_AUDIO_SPATIALIZATION_T000_P000
const size_t kExpectedSpatializationNameLength = 31;
if (strlen(name) != kExpectedSpatializationNameLength) {
return WebData();
}
// Extract the azimuth and elevation from the resource name.
int azimuth = 0;
int elevation = 0;
int values_parsed =
sscanf(name, "IRC_Composite_C_R0195_T%3d_P%3d", &azimuth, &elevation);
if (values_parsed != 2) {
return WebData();
}
// The resource index values go through the elevations first, then azimuths.
const int kAngleSpacing = 15;
// 0 <= elevation <= 90 (or 315 <= elevation <= 345)
// in increments of 15 degrees.
int elevation_index =
elevation <= 90 ? elevation / kAngleSpacing :
7 + (elevation - 315) / kAngleSpacing;
bool is_elevation_index_good = 0 <= elevation_index && elevation_index < 10;
// 0 <= azimuth < 360 in increments of 15 degrees.
int azimuth_index = azimuth / kAngleSpacing;
bool is_azimuth_index_good = 0 <= azimuth_index && azimuth_index < 24;
const int kNumberOfElevations = 10;
const int kNumberOfAudioResources = 240;
int resource_index = kNumberOfElevations * azimuth_index + elevation_index;
bool is_resource_index_good = 0 <= resource_index &&
resource_index < kNumberOfAudioResources;
if (is_azimuth_index_good && is_elevation_index_good &&
is_resource_index_good) {
const int kFirstAudioResourceIndex = IDR_AUDIO_SPATIALIZATION_T000_P000;
base::StringPiece resource = GetContentClient()->GetDataResource(
kFirstAudioResourceIndex + resource_index, ui::SCALE_FACTOR_NONE);
return WebData(resource.data(), resource.size());
}
#endif // IDR_AUDIO_SPATIALIZATION_T000_P000
NOTREACHED();
return WebData();
}
// This must match third_party/WebKit/public/blink_resources.grd.
// In particular, |is_gzipped| corresponds to compress="gzip".
struct DataResource {
......@@ -434,6 +377,8 @@ const DataResource kDataResources[] = {
{"placeholderIcon", IDR_PLACEHOLDER_ICON, ui::SCALE_FACTOR_100P, false},
{"brokenCanvas", IDR_BROKENCANVAS, ui::SCALE_FACTOR_100P, false},
{"brokenCanvas@2x", IDR_BROKENCANVAS, ui::SCALE_FACTOR_200P, false},
{"Composite", IDR_AUDIO_SPATIALIZATION_COMPOSITE, ui::SCALE_FACTOR_NONE,
false},
};
class NestedMessageLoopRunnerImpl
......@@ -497,11 +442,6 @@ WebData BlinkPlatformImpl::GetDataResource(const char* name) {
if (!strlen(name))
return WebData();
// Check the name prefix to see if it's an audio resource.
if (base::StartsWith(name, "IRC_Composite", base::CompareCase::SENSITIVE) ||
base::StartsWith(name, "Composite", base::CompareCase::SENSITIVE))
return loadAudioSpatializationResource(name);
// TODO(flackr): We should use a better than linear search here, a trie would
// be ideal.
for (size_t i = 0; i < base::size(kDataResources); ++i) {
......
......@@ -125,12 +125,6 @@ bool HRTFElevation::CalculateKernelsForAzimuthElevation(
if (!is_elevation_good)
return false;
// Construct the resource name from the subject name, azimuth, and elevation,
// for example:
// "IRC_Composite_C_R0195_T015_P000"
// Note: the passed in subjectName is not a string passed in via JavaScript or
// the web. It's passed in as an internal ASCII identifier and is an
// implementation detail.
int positive_elevation = elevation < 0 ? elevation + 360 : elevation;
scoped_refptr<AudioBus> bus(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment