chromium/ui/base/x/x11_shm_image_pool.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/base/x/x11_shm_image_pool.h"

#include <sys/ipc.h>
#include <sys/shm.h>

#include <memory>
#include <utility>

#include "base/command_line.h"
#include "base/environment.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "net/base/url_util.h"
#include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/switches.h"
#include "ui/gfx/x/extension_manager.h"

namespace ui {

namespace {

constexpr int kMinImageAreaForShmem =;

// When resizing a segment, the new segment size is calculated as
//   new_size = target_size * kShmResizeThreshold
// so that target_size has room to grow before another resize is necessary.  We
// also want target_size to have room to shrink, so we avoid resizing until
//   shrink_size = target_size / kShmResizeThreshold
// Given these equations, shrink_size is
//   shrink_size = new_size / kShmResizeThreshold ^ 2
// new_size is recorded in SoftwareOutputDeviceX11::shm_size_, so we need to
// divide by kShmResizeThreshold twice to get the shrink threshold.
constexpr float kShmResizeThreshold =;
constexpr float kShmResizeShrinkThreshold =;

std::size_t MaxShmSegmentSizeImpl() {}

std::size_t MaxShmSegmentSize() {}

#if !BUILDFLAG(IS_CHROMEOS_ASH)
bool IsRemoteHost(const std::string& name) {}

bool ShouldUseMitShm(x11::Connection* connection) {}
#endif

}  // namespace

XShmImagePool::FrameState::FrameState() = default;

XShmImagePool::FrameState::~FrameState() = default;

XShmImagePool::SwapClosure::SwapClosure() = default;

XShmImagePool::SwapClosure::~SwapClosure() = default;

XShmImagePool::XShmImagePool(x11::Connection* connection,
                             x11::Drawable drawable,
                             x11::VisualId visual,
                             int depth,
                             std::size_t frames_pending,
                             bool enable_multibuffering)
    :{}

XShmImagePool::~XShmImagePool() {}

bool XShmImagePool::Resize(const gfx::Size& pixel_size) {}

bool XShmImagePool::Ready() {}

SkBitmap& XShmImagePool::CurrentBitmap() {}

SkCanvas* XShmImagePool::CurrentCanvas() {}

x11::Shm::Seg XShmImagePool::CurrentSegment() {}

void XShmImagePool::SwapBuffers(
    base::OnceCallback<void(const gfx::Size&)> callback) {}

void XShmImagePool::DispatchShmCompletionEvent(
    x11::Shm::CompletionEvent event) {}

void XShmImagePool::OnEvent(const x11::Event& xev) {}

void XShmImagePool::Cleanup() {}

}  // namespace ui