Skip to content

Commit

Permalink
Revert "Add PassedTimingAllowOriginCheck to the DataSource interface"
Browse files Browse the repository at this point in the history
This reverts commit f6571a1.

Reason for revert: Breaking https://ci.chromium.org/p/chrome/builders/ci/linux-chromeos-chrome

Original change's description:
> Add PassedTimingAllowOriginCheck to the DataSource interface
>
> One more spot where we can get rid of |mb_data_source_|. Only 30 more to
> go!
>
> Bug: 1377053
> Change-Id: I2d2d392147dcb345fa6387f5565fc5b31a050a14
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3989262
> Commit-Queue: Ted (Chromium) Meyer <tmathmeyer@chromium.org>
> Reviewed-by: Will Cassella <cassew@chromium.org>
> Reviewed-by: Matthew Wolenetz <wolenetz@chromium.org>
> Reviewed-by: Tommy Li <tommycli@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1067304}

Bug: 1377053
Change-Id: I61a27a86aa95e5208e70e32fd6cadf6d7b94462e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4003345
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Jiewei Qian <qjw@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1067399}
  • Loading branch information
wacky6 authored and Chromium LUCI CQ committed Nov 4, 2022
1 parent c745d6e commit 21d59ac
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 29 deletions.
8 changes: 0 additions & 8 deletions chrome/services/media_gallery_util/ipc_data_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,3 @@ void IPCDataSource::ReadDone(uint8_t* destination,
base::ranges::copy(data, destination);
std::move(callback).Run(data.size());
}

bool IPCDataSource::PassedTimingAllowOriginCheck() {
// The mojo ipc channel doesn't support this yet, so cautiously return false,
// for now.
// TODO(crbug/1377053): Rework this method to be asynchronous, if possible,
// so that the mojo interface can be queried.
return false;
}
1 change: 0 additions & 1 deletion chrome/services/media_gallery_util/ipc_data_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class IPCDataSource : public media::DataSource {
[[nodiscard]] bool GetSize(int64_t* size_out) override;
bool IsStreaming() override;
void SetBitrate(int bitrate) override;
bool PassedTimingAllowOriginCheck() override;

private:
// Media data read helpers: must be run on the utility thread.
Expand Down
7 changes: 1 addition & 6 deletions media/base/data_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ class MEDIA_EXPORT DataSource {
// Values of |bitrate| <= 0 are invalid and should be ignored.
virtual void SetBitrate(int bitrate) = 0;

// If there is a MultiBuffer associated with this data source, then defer to
// it. This will return false if any HTTP response so far has failed the TAO
// check.
virtual bool PassedTimingAllowOriginCheck() = 0;

// Assume fully buffered by default.
// Assume fully bufferred by default.
virtual bool AssumeFullyBuffered() const;

// By default this just returns GetSize().
Expand Down
5 changes: 0 additions & 5 deletions media/filters/file_data_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,4 @@ void FileDataSource::SetBitrate(int bitrate) {}

FileDataSource::~FileDataSource() = default;

bool FileDataSource::PassedTimingAllowOriginCheck() {
// There are no HTTP responses, so this can safely return true.
return true;
}

} // namespace media
1 change: 0 additions & 1 deletion media/filters/file_data_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class MEDIA_EXPORT FileDataSource : public DataSource {
[[nodiscard]] bool GetSize(int64_t* size_out) override;
bool IsStreaming() override;
void SetBitrate(int bitrate) override;
bool PassedTimingAllowOriginCheck() final;

// Unit test helpers. Recreate the object if you want the default behaviour.
void force_read_errors_for_testing() { force_read_errors_ = true; }
Expand Down
5 changes: 0 additions & 5 deletions media/filters/memory_data_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,4 @@ bool MemoryDataSource::IsStreaming() {

void MemoryDataSource::SetBitrate(int bitrate) {}

bool MemoryDataSource::PassedTimingAllowOriginCheck() {
// There are no HTTP responses, so this can safely return true.
return true;
}

} // namespace media
1 change: 0 additions & 1 deletion media/filters/memory_data_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class MEDIA_EXPORT MemoryDataSource final : public DataSource {
[[nodiscard]] bool GetSize(int64_t* size_out) final;
bool IsStreaming() final;
void SetBitrate(int bitrate) final;
bool PassedTimingAllowOriginCheck() final;

private:
const std::string data_string_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PLATFORM_EXPORT MultiBufferDataSource : public media::DataSource {
// header (that is not "null").
bool HasAccessControl() const;

bool PassedTimingAllowOriginCheck() override;
bool PassedTimingAllowOriginCheck();

// Returns the CorsMode of the underlying UrlData.
UrlData::CorsMode cors_mode() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4132,6 +4132,11 @@ void WebMediaPlayerImpl::ReportSessionUMAs() const {
}

bool WebMediaPlayerImpl::PassedTimingAllowOriginCheck() const {
// If there is a MultiBuffer associated with this player, then defer to it.
// This will return false if any HTTP response so far has failed the TAO
// check.
if (mb_data_source_)
return mb_data_source_->PassedTimingAllowOriginCheck();
// If there is no MultiBuffer, then there are no HTTP responses, and so this
// can safely return true. Specifically for the MSE case, the app itself
// sources the ArrayBuffer[Views], possibly not even from HTTP responses. Any
Expand All @@ -4143,7 +4148,7 @@ bool WebMediaPlayerImpl::PassedTimingAllowOriginCheck() const {
// revealed via the MediaSource or WebMediaPlayer that's using MSE.
// TODO(1266991): Ensure that this returns the correct value for HLS media,
// based on the TAO checks performed on those resources.
return data_source_ ? data_source_->PassedTimingAllowOriginCheck() : true;
return true;
}

} // namespace blink

0 comments on commit 21d59ac

Please sign in to comment.