| Index: services/ui/surfaces/display_compositor.h
|
| diff --git a/services/ui/surfaces/display_compositor.h b/services/ui/surfaces/display_compositor.h
|
| index 4ec50dedbc9b1a10e02f53216ccfcf6834dacf80..6da3c1dec22a74dcc0356c05bf91b3e7a335a840 100644
|
| --- a/services/ui/surfaces/display_compositor.h
|
| +++ b/services/ui/surfaces/display_compositor.h
|
| @@ -1,84 +1,60 @@
|
| -// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Copyright 2015 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.
|
|
|
| #ifndef SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
|
| #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
|
|
|
| -#include "cc/surfaces/display_client.h"
|
| -#include "cc/surfaces/surface.h"
|
| -#include "cc/surfaces/surface_factory.h"
|
| -#include "cc/surfaces/surface_factory_client.h"
|
| -#include "cc/surfaces/surface_id_allocator.h"
|
| -#include "services/ui/surfaces/surfaces_state.h"
|
| -#include "ui/gfx/native_widget_types.h"
|
| +#include <stdint.h>
|
|
|
| -namespace cc {
|
| -class Display;
|
| -}
|
| +#include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "cc/surfaces/surface_manager.h"
|
|
|
| -namespace gpu {
|
| -class GpuChannelHost;
|
| -}
|
| +namespace cc {
|
| +class SurfaceHittest;
|
| +class SurfaceManager;
|
| +} // namespace cc
|
|
|
| namespace ui {
|
| +namespace surfaces {
|
|
|
| -// TODO(fsamuel): This should become a mojo interface for the mus-gpu split.
|
| -// TODO(fsamuel): This should not be a SurfaceFactoryClient.
|
| -// The DisplayCompositor receives CompositorFrames from all sources,
|
| -// creates a top-level CompositorFrame once per tick, and generates graphical
|
| -// output.
|
| -class DisplayCompositor : public cc::SurfaceFactoryClient,
|
| - public cc::DisplayClient {
|
| - public:
|
| - DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
| - gfx::AcceleratedWidget widget,
|
| - scoped_refptr<gpu::GpuChannelHost> gpu_channel,
|
| - const scoped_refptr<SurfacesState>& surfaces_state);
|
| - ~DisplayCompositor() override;
|
| +class DisplayCompositorClient;
|
|
|
| - // DisplayCompositor embedders submit a CompositorFrame when content on the
|
| - // display should be changed. A well-behaving embedder should only submit
|
| - // a CompositorFrame once per BeginFrame tick. The callback is called the
|
| - // first time this frame is used to draw, or if the frame is discarded.
|
| - void SubmitCompositorFrame(cc::CompositorFrame frame,
|
| - const base::Callback<void()>& callback);
|
| -
|
| - // TODO(fsamuel): This is used for surface hittesting and should not be
|
| - // exposed outside of DisplayCompositor.
|
| - const cc::SurfaceId& surface_id() const { return surface_id_; }
|
| +// The DisplayCompositor object is an object global to the Window Manager app
|
| +// that holds the SurfaceManager and allocates new Surfaces namespaces.
|
| +// This object lives on the main thread of the Window Manager.
|
| +// TODO(rjkroege, fsamuel): This object will need to change to support multiple
|
| +// displays.
|
| +class DisplayCompositor : public base::RefCounted<DisplayCompositor>,
|
| + public cc::SurfaceManager::Delegate {
|
| + public:
|
| + explicit DisplayCompositor(DisplayCompositorClient* client);
|
|
|
| - // This requests the display CompositorFrame be rendered and given to the
|
| - // callback within CopyOutputRequest.
|
| - void RequestCopyOfOutput(
|
| - std::unique_ptr<cc::CopyOutputRequest> output_request);
|
| + uint32_t next_client_id() { return next_client_id_++; }
|
|
|
| - // TODO(fsamuel): Invent an async way to create a SurfaceNamespace
|
| - // A SurfaceNamespace can create CompositorFrameSinks where the client can
|
| - // make up the ID.
|
| + cc::SurfaceManager* manager() { return &manager_; }
|
|
|
| private:
|
| - // SurfaceFactoryClient implementation.
|
| - void ReturnResources(const cc::ReturnedResourceArray& resources) override;
|
| - void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
|
| + friend class base::RefCounted<DisplayCompositor>;
|
| + ~DisplayCompositor() override;
|
|
|
| - // DisplayClient implementation.
|
| - void DisplayOutputSurfaceLost() override;
|
| - void DisplayWillDrawAndSwap(bool will_draw_and_swap,
|
| - const cc::RenderPassList& render_passes) override;
|
| - void DisplayDidDrawAndSwap() override;
|
| + // cc::SurfaceManager::Delegate:
|
| + void OnSurfaceCreated(const gfx::Size& size,
|
| + float device_scale_factor,
|
| + const cc::SurfaceId& surface_id) override;
|
|
|
| - scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
| - scoped_refptr<SurfacesState> surfaces_state_;
|
| - cc::SurfaceFactory factory_;
|
| - cc::SurfaceIdAllocator allocator_;
|
| - cc::SurfaceId surface_id_;
|
| + DisplayCompositorClient* const client_;
|
| + // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated
|
| + // by the Surfaces service, and the low 32-bits are generated by the process
|
| + // that requested the Surface.
|
| + uint32_t next_client_id_;
|
| + cc::SurfaceManager manager_;
|
|
|
| - gfx::Size display_size_;
|
| - std::unique_ptr<cc::Display> display_;
|
| DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
|
| };
|
|
|
| +} // namespace surfaces
|
| } // namespace ui
|
|
|
| -#endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
|
| +#endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_
|
|
|