#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 = …;
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
}
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() { … }
}