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

Unified Diff: components/mus/public/cpp/lib/command_buffer_client_impl.cc

Issue 2096293002: Eliminate usage of InterfacePtr::WaitForIncomingResponse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/mus/public/cpp/lib/command_buffer_client_impl.cc
diff --git a/components/mus/public/cpp/lib/command_buffer_client_impl.cc b/components/mus/public/cpp/lib/command_buffer_client_impl.cc
index 062c3f784779dbc80df7b3b59ca2c511960ab66f..f8959cbe0eda9b4b2ea955e64490fb228a8de6f4 100644
--- a/components/mus/public/cpp/lib/command_buffer_client_impl.cc
+++ b/components/mus/public/cpp/lib/command_buffer_client_impl.cc
@@ -12,7 +12,6 @@
#include "base/logging.h"
#include "base/process/process_handle.h"
-#include "base/threading/thread_restrictions.h"
#include "components/mus/common/gpu_type_converters.h"
#include "components/mus/common/mojo_buffer_backing.h"
#include "components/mus/common/mojo_gpu_memory_buffer.h"
@@ -40,16 +39,6 @@ bool CreateAndMapSharedBuffer(size_t size,
return true;
}
-void MakeProgressCallback(gpu::CommandBuffer::State* output,
- const gpu::CommandBuffer::State& input) {
- *output = input;
-}
-
-void InitializeCallback(mus::mojom::CommandBufferInitializeResultPtr* output,
- mus::mojom::CommandBufferInitializeResultPtr input) {
- *output = std::move(input);
-}
-
} // namespace
CommandBufferClientImpl::CommandBufferClientImpl(
@@ -87,13 +76,11 @@ bool CommandBufferClientImpl::Initialize() {
client_binding_.Bind(GetProxy(&client_ptr));
mus::mojom::CommandBufferInitializeResultPtr initialize_result;
- command_buffer_->Initialize(
+ bool handled = command_buffer_->Initialize(
std::move(client_ptr), std::move(handle),
- mojo::Array<int32_t>::From(attribs_),
- base::Bind(&InitializeCallback, &initialize_result));
+ mojo::Array<int32_t>::From(attribs_), &initialize_result);
- base::ThreadRestrictions::ScopedAllowWait wait;
- if (!command_buffer_.WaitForIncomingResponse()) {
+ if (!handled) {
VLOG(1) << "Channel encountered error while creating command buffer.";
return false;
}
@@ -297,11 +284,9 @@ void CommandBufferClientImpl::TryUpdateState() {
void CommandBufferClientImpl::MakeProgressAndUpdateState() {
gpu::CommandBuffer::State state;
- command_buffer_->MakeProgress(last_state_.get_offset,
- base::Bind(&MakeProgressCallback, &state));
+ bool handled = command_buffer_->MakeProgress(last_state_.get_offset, &state);
- base::ThreadRestrictions::ScopedAllowWait wait;
- if (!command_buffer_.WaitForIncomingResponse()) {
+ if (!handled) {
VLOG(1) << "Channel encountered error while waiting for command buffer.";
// TODO(piman): is it ok for this to re-enter?
Destroyed(gpu::error::kUnknown, gpu::error::kLostContext);

Powered by Google App Engine
This is Rietveld 408576698