Provide a PlatformView implementation for Linux (#2796)

This commit is contained in:
Jason Simmons 2016-07-13 14:39:53 -07:00 committed by GitHub
parent 3976beb11b
commit ca72520d93
2 changed files with 66 additions and 3 deletions

View File

@ -2,13 +2,36 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/shell/platform_view.h"
#include "sky/shell/platform/linux/platform_view_linux.h"
namespace sky {
namespace shell {
PlatformView* PlatformView::Create(const Config& config) {
return new PlatformView(config);
PlatformView* PlatformView::Create(const Config& config,
SurfaceConfig surface_config) {
return new PlatformViewLinux(config, surface_config);
}
PlatformViewLinux::PlatformViewLinux(const Config& config,
SurfaceConfig surface_config)
: PlatformView(config, surface_config), weak_factory_(this) {}
PlatformViewLinux::~PlatformViewLinux() {}
base::WeakPtr<sky::shell::PlatformView> PlatformViewLinux::GetWeakViewPtr() {
return weak_factory_.GetWeakPtr();
}
uint64_t PlatformViewLinux::DefaultFramebuffer() const {
return 0;
}
bool PlatformViewLinux::ContextMakeCurrent() {
return false;
}
bool PlatformViewLinux::SwapBuffers() {
return false;
}
} // namespace shell

View File

@ -0,0 +1,40 @@
// Copyright 2016 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_SHELL_PLATFORM_LINUX_PLATFORM_VIEW_LINUX_H_
#define SKY_SHELL_PLATFORM_LINUX_PLATFORM_VIEW_LINUX_H_
#include "sky/shell/platform_view.h"
namespace sky {
namespace shell {
class PlatformViewLinux : public PlatformView {
public:
explicit PlatformViewLinux(const Config& config, SurfaceConfig surface_config);
~PlatformViewLinux() override;
// sky::shell::PlatformView override
base::WeakPtr<sky::shell::PlatformView> GetWeakViewPtr() override;
// sky::shell::PlatformView override
uint64_t DefaultFramebuffer() const override;
// sky::shell::PlatformView override
bool ContextMakeCurrent() override;
// sky::shell::PlatformView override
bool SwapBuffers() override;
private:
base::WeakPtrFactory<PlatformViewLinux> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(PlatformViewLinux);
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_LINUX_PLATFORM_VIEW_LINUX_H_