Snap for 6317653 from 7696e800b89ca053010aeace2a8e6eae659a4104 to qt-qpr3-release
Change-Id: I7d82583eecdcf99df2acee27074bcfa59ab92f91
diff --git a/src/profiling/memory/client.cc b/src/profiling/memory/client.cc
index 59c7e20..37453d1 100644
--- a/src/profiling/memory/client.cc
+++ b/src/profiling/memory/client.cc
@@ -202,10 +202,7 @@
}
PERFETTO_DCHECK(client_config.interval >= 1);
- // TODO(fmayer): Always make this nonblocking.
- // This is so that without block_client, we get the old behaviour that rate
- // limits using the blocking socket. We do not want to change that for Q.
- sock.SetBlocking(!client_config.block_client);
+ sock.SetBlocking(false);
Sampler sampler{client_config.interval};
// note: the shared_ptr will retain a copy of the unhooked_allocator
return std::allocate_shared<Client>(unhooked_allocator, std::move(sock),
@@ -368,10 +365,12 @@
}
bool Client::SendControlSocketByte() {
- // TODO(fmayer): Fix the special casing that only block_client uses a
- // nonblocking socket.
+ // If base::IsAgain(errno), the socket buffer is full, so the service will
+ // pick up the notification even without adding another byte.
+ // In other error cases (usually EPIPE) we want to disconnect, because that
+ // is how the service signals the tracing session was torn down.
if (sock_.Send(kSingleByte, sizeof(kSingleByte)) == -1 &&
- (!client_config_.block_client || !base::IsAgain(errno))) {
+ !base::IsAgain(errno)) {
PERFETTO_PLOG("Failed to send control socket byte.");
return false;
}
diff --git a/src/profiling/memory/unwinding.cc b/src/profiling/memory/unwinding.cc
index cc79477..31b9a9c 100644
--- a/src/profiling/memory/unwinding.cc
+++ b/src/profiling/memory/unwinding.cc
@@ -314,9 +314,7 @@
shmem.EndRead(std::move(buf));
// Reparsing takes time, so process the rest in a new batch to avoid timing
// out.
- // TODO(fmayer): Do not special case blocking mode.
- if (client_data.client_config.block_client &&
- reparses_before < client_data.metadata.reparses) {
+ if (reparses_before < client_data.metadata.reparses) {
repost_task = true;
break;
}