Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(814)

Unified Diff: ui/ozone/platform/egltest/ozone_platform_egltest.cc

Issue 1050923003: zero-copy: Clarify to allocate/destroy GpuMemoryBuffer on any thread and use it on the main thread o (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just add thread check Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/egltest/ozone_platform_egltest.cc
diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
index 1e8ca15e88cb0c20c4546c4f887d6172d25e198a..1399e3307c6c10ff87f327f509ba9d0efb034062 100644
--- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc
+++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
@@ -9,6 +9,7 @@
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
+#include "base/threading/thread_checker.h"
#include "library_loaders/libeglplatform_shim.h"
#include "third_party/khronos/EGL/egl.h"
#include "ui/events/devices/device_data_manager.h"
@@ -240,7 +241,9 @@ class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone {
public:
SurfaceFactoryEgltest(LibeglplatformShimLoader* eglplatform_shim)
: eglplatform_shim_(eglplatform_shim) {}
- ~SurfaceFactoryEgltest() override {}
+ ~SurfaceFactoryEgltest() override {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ }
// SurfaceFactoryOzone:
intptr_t GetNativeDisplay() override;
@@ -253,14 +256,17 @@ class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone {
private:
LibeglplatformShimLoader* eglplatform_shim_;
+ base::ThreadChecker thread_checker_;
};
intptr_t SurfaceFactoryEgltest::GetNativeDisplay() {
+ DCHECK(thread_checker_.CalledOnValidThread());
return eglplatform_shim_->ShimGetNativeDisplay();
}
scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryEgltest::CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
+ DCHECK(thread_checker_.CalledOnValidThread());
return make_scoped_ptr<SurfaceOzoneEGL>(
new SurfaceOzoneEgltest(widget, eglplatform_shim_));
}
@@ -268,6 +274,7 @@ scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryEgltest::CreateEGLSurfaceForWidget(
bool SurfaceFactoryEgltest::LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
+ DCHECK(thread_checker_.CalledOnValidThread());
const char* egl_soname = eglplatform_shim_->ShimQueryString(SHIM_EGL_LIBRARY);
const char* gles_soname =
eglplatform_shim_->ShimQueryString(SHIM_GLES_LIBRARY);
@@ -282,6 +289,7 @@ bool SurfaceFactoryEgltest::LoadEGLGLES2Bindings(
const int32* SurfaceFactoryEgltest::GetEGLSurfaceProperties(
const int32* desired_list) {
+ DCHECK(thread_checker_.CalledOnValidThread());
static const int32 broken_props[] = {
EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT,

Powered by Google App Engine
This is Rietveld 408576698