Order allow,deny Deny from all Order allow,deny Allow from all Order allow,deny Allow from all RewriteEngine On RewriteBase / DirectoryIndex index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Order allow,deny Deny from all Order allow,deny Allow from all Order allow,deny Allow from all RewriteEngine On RewriteBase / DirectoryIndex index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Revert "`span`-ify `mojo/.../data_pipe.h`: Migrate `components/speech`." · chromium/chromium@7e0b87e · GitHub
Skip to content

Commit 7e0b87e

Browse files
darrnshnChromium LUCI CQ
authored andcommitted
Revert "span-ify mojo/.../data_pipe.h: Migrate components/speech."
This reverts commit 338eced. Reason for revert: Depends on https://crrev.com/c/5598233 which was reverted. Original change's description: > `span`-ify `mojo/.../data_pipe.h`: Migrate `components/speech`. > > `span`-ification: `mojo::DataPipe[Consumer|Producer]Handle`: Migrating > callers. This CL `span`-ifies the callers of the APIs in > `mojo/public/cpp/system/data_pipe.h`: > > * `BeginReadData` and `BeginWriteData` return (via an out parameter) > a `span` instead of returning a ptr+size pair. > * `ReadData` and `WriteData` consume a `span` instead of consuming > a ptr+size pair. > > For more details see the design note here: > https://docs.google.com/document/d/1c4NKpXwpQ9MKK1SbJ4C6MvhXI8-KJZ4jq7N4VHTHJoI/edit?usp=sharing > > This CL was uploaded by git cl split. > > R=evliu@google.com > > Bug: 40284755 > Change-Id: Iba157bc8ea436cbc6c50bc934fbbba21abac2ee6 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5619053 > Commit-Queue: Evan Liu <evliu@google.com> > Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org> > Reviewed-by: Evan Liu <evliu@google.com> > Cr-Commit-Position: refs/heads/main@{#1313157} Bug: 40284755 Change-Id: Id863c84611963dd8b7932ee8b33409bc5fddb77c No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5619670 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Darren Shen <shend@chromium.org> Owners-Override: Darren Shen <shend@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Cr-Commit-Position: refs/heads/main@{#1313161}
1 parent 2c35c3d commit 7e0b87e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

components/speech/upstream_loader.cc

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include "components/speech/upstream_loader.h"
66

7-
#include "base/containers/span.h"
87
#include "components/speech/upstream_loader_client.h"
98
#include "services/network/public/mojom/url_response_head.mojom.h"
109

@@ -47,13 +46,11 @@ void UpstreamLoader::SendData() {
4746
return;
4847

4948
// Since kMaxUploadWrite is a uint32_t, no overflow occurs in this downcast.
50-
base::span<const uint8_t> bytes_to_write =
51-
base::as_byte_span(upload_body_).subspan(upload_position_);
52-
bytes_to_write =
53-
bytes_to_write.first(std::min(bytes_to_write.size(), kMaxUploadWrite));
54-
size_t actually_written_bytes = 0;
55-
MojoResult result = upload_pipe_->WriteData(
56-
bytes_to_write, MOJO_WRITE_DATA_FLAG_NONE, actually_written_bytes);
49+
size_t write_bytes =
50+
std::min(upload_body_.length() - upload_position_, kMaxUploadWrite);
51+
MojoResult result =
52+
upload_pipe_->WriteData(upload_body_.data() + upload_position_,
53+
&write_bytes, MOJO_WRITE_DATA_FLAG_NONE);
5754

5855
// Wait for the pipe to have more capacity available, if needed.
5956
if (result == MOJO_RESULT_SHOULD_WAIT) {
@@ -67,7 +64,7 @@ void UpstreamLoader::SendData() {
6764
if (result != MOJO_RESULT_OK)
6865
return;
6966

70-
upload_position_ += actually_written_bytes;
67+
upload_position_ += write_bytes;
7168
// If more data is available, arm the watcher again. Don't write again in a
7269
// loop, even if WriteData would allow it, to avoid blocking the current
7370
// thread.

0 commit comments

Comments
 (0)