Skip to content

Commit

Permalink
Provide a PlatformView implementation for Linux (flutter#2796)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored Jul 13, 2016
1 parent 3976beb commit ca72520
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 3 deletions.
29 changes: 26 additions & 3 deletions sky/shell/platform/linux/platform_view_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions sky/shell/platform/linux/platform_view_linux.h
Original file line number Diff line number Diff line change
@@ -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_

0 comments on commit ca72520

Please sign in to comment.