| // Copyright 2019 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wunused-private-field" |
| #elif defined(_MSC_VER) |
| #pragma warning(push) |
| #pragma warning(disable:4056) |
| #pragma warning(disable:4065) |
| #pragma warning(disable:4756) |
| #endif |
| |
| |
| #include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom-test-utils.h" |
| |
| #include <utility> |
| |
| #include "base/bind.h" |
| #include "base/run_loop.h" |
| #include "mojo/public/mojom/base/shared_memory.mojom.h" |
| #include "ui/gfx/geometry/mojo/geometry.mojom.h" |
| |
| |
| #ifndef SERVICES_VIZ_PRIVILEGED_INTERFACES_COMPOSITING_LAYERED_WINDOW_UPDATER_MOJOM_JUMBO_H_ |
| #define SERVICES_VIZ_PRIVILEGED_INTERFACES_COMPOSITING_LAYERED_WINDOW_UPDATER_MOJOM_JUMBO_H_ |
| #include "mojo/public/cpp/base/shared_memory_mojom_traits.h" |
| #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
| #endif |
| |
| |
| namespace viz { |
| namespace mojom { |
| |
| |
| void LayeredWindowUpdaterInterceptorForTesting::OnAllocatedSharedMemory(const gfx::Size& pixel_size, base::UnsafeSharedMemoryRegion region) { |
| GetForwardingInterface()->OnAllocatedSharedMemory(std::move(pixel_size), std::move(region)); |
| } |
| void LayeredWindowUpdaterInterceptorForTesting::Draw(DrawCallback callback) { |
| GetForwardingInterface()->Draw(std::move(callback)); |
| } |
| LayeredWindowUpdaterAsyncWaiter::LayeredWindowUpdaterAsyncWaiter( |
| LayeredWindowUpdater* proxy) : proxy_(proxy) {} |
| |
| LayeredWindowUpdaterAsyncWaiter::~LayeredWindowUpdaterAsyncWaiter() = default; |
| |
| void LayeredWindowUpdaterAsyncWaiter::Draw( |
| ) { |
| base::RunLoop loop; |
| proxy_->Draw( |
| base::BindOnce( |
| [](base::RunLoop* loop) { |
| loop->Quit(); |
| }, |
| &loop)); |
| loop.Run(); |
| } |
| |
| |
| |
| |
| |
| } // namespace mojom |
| } // namespace viz |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #elif defined(_MSC_VER) |
| #pragma warning(pop) |
| #endif |