mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
mojo.Surface's client had two methods: *) SetIdNamespace replaced by mojo.Surface.GetIdNamespace which returns the id namespace via a callback. *) ReturnResources split into a ResourceReturner interface which can be (optionally) set on the mojo.Surface via mojo.Surface.SetResourceReturner Also beefed up the comments a bit. BUG=451319 R=sky@chromium.org Review URL: https://codereview.chromium.org/871373015
63 lines
1.6 KiB
C++
63 lines
1.6 KiB
C++
// Copyright 2014 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 SKY_COMPOSITOR_SURFACE_HOLDER_H_
|
|
#define SKY_COMPOSITOR_SURFACE_HOLDER_H_
|
|
|
|
#include "base/callback_forward.h"
|
|
#include "base/memory/scoped_ptr.h"
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "mojo/services/surfaces/public/interfaces/surface_id.mojom.h"
|
|
#include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h"
|
|
#include "ui/gfx/geometry/rect.h"
|
|
|
|
namespace mojo {
|
|
class Shell;
|
|
}
|
|
|
|
namespace sky {
|
|
class SurfaceAllocator;
|
|
|
|
class SurfaceHolder : public mojo::ResourceReturner {
|
|
public:
|
|
class Client {
|
|
public:
|
|
virtual void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) = 0;
|
|
virtual void ReturnResources(
|
|
mojo::Array<mojo::ReturnedResourcePtr> resources) = 0;
|
|
|
|
protected:
|
|
virtual ~Client();
|
|
};
|
|
|
|
explicit SurfaceHolder(Client* client, mojo::Shell* shell);
|
|
~SurfaceHolder() override;
|
|
|
|
void SetSize(const gfx::Size& size);
|
|
void SubmitFrame(mojo::FramePtr frame, const base::Closure& callback);
|
|
|
|
private:
|
|
// mojo::ResourceReturner
|
|
void ReturnResources(
|
|
mojo::Array<mojo::ReturnedResourcePtr> resources) override;
|
|
|
|
void SetIdNamespace(uint32_t id_namespace);
|
|
void SetQualifiedId();
|
|
|
|
Client* client_;
|
|
gfx::Size size_;
|
|
uint32_t id_namespace_;
|
|
uint32_t local_id_;
|
|
mojo::SurfacePtr surface_;
|
|
mojo::Binding<mojo::ResourceReturner> returner_binding_;
|
|
|
|
base::WeakPtrFactory<SurfaceHolder> weak_factory_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(SurfaceHolder);
|
|
};
|
|
|
|
} // namespace sky
|
|
|
|
#endif // SKY_COMPOSITOR_SURFACE_HOLDER_H_
|