| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 void WaitForFence(EGLDisplay display, EGLSyncKHR fence) { | 67 void WaitForFence(EGLDisplay display, EGLSyncKHR fence) { |
| 68 eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, | 68 eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, |
| 69 EGL_FOREVER_KHR); | 69 EGL_FOREVER_KHR); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // A thin wrapper around GLSurfaceEGL that owns the EGLNativeWindow. | 72 // A thin wrapper around GLSurfaceEGL that owns the EGLNativeWindow. |
| 73 class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { | 73 class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { |
| 74 public: | 74 public: |
| 75 GLSurfaceOzoneEGL(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, | 75 GLSurfaceOzoneEGL(std::unique_ptr<ui::SurfaceOzoneEGL> ozone_surface, |
| 76 AcceleratedWidget widget); | 76 AcceleratedWidget widget); |
| 77 | 77 |
| 78 // GLSurface: | 78 // GLSurface: |
| 79 bool Initialize(gfx::GLSurface::Format format) override; | 79 bool Initialize(gfx::GLSurface::Format format) override; |
| 80 bool Resize(const gfx::Size& size, | 80 bool Resize(const gfx::Size& size, |
| 81 float scale_factor, | 81 float scale_factor, |
| 82 bool has_alpha) override; | 82 bool has_alpha) override; |
| 83 gfx::SwapResult SwapBuffers() override; | 83 gfx::SwapResult SwapBuffers() override; |
| 84 bool ScheduleOverlayPlane(int z_order, | 84 bool ScheduleOverlayPlane(int z_order, |
| 85 OverlayTransform transform, | 85 OverlayTransform transform, |
| 86 GLImage* image, | 86 GLImage* image, |
| 87 const Rect& bounds_rect, | 87 const Rect& bounds_rect, |
| 88 const RectF& crop_rect) override; | 88 const RectF& crop_rect) override; |
| 89 EGLConfig GetConfig() override; | 89 EGLConfig GetConfig() override; |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 using NativeViewGLSurfaceEGL::Initialize; | 92 using NativeViewGLSurfaceEGL::Initialize; |
| 93 | 93 |
| 94 ~GLSurfaceOzoneEGL() override; | 94 ~GLSurfaceOzoneEGL() override; |
| 95 | 95 |
| 96 bool ReinitializeNativeSurface(); | 96 bool ReinitializeNativeSurface(); |
| 97 | 97 |
| 98 // The native surface. Deleting this is allowed to free the EGLNativeWindow. | 98 // The native surface. Deleting this is allowed to free the EGLNativeWindow. |
| 99 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; | 99 std::unique_ptr<ui::SurfaceOzoneEGL> ozone_surface_; |
| 100 AcceleratedWidget widget_; | 100 AcceleratedWidget widget_; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneEGL); | 102 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneEGL); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 GLSurfaceOzoneEGL::GLSurfaceOzoneEGL( | 105 GLSurfaceOzoneEGL::GLSurfaceOzoneEGL( |
| 106 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, | 106 std::unique_ptr<ui::SurfaceOzoneEGL> ozone_surface, |
| 107 AcceleratedWidget widget) | 107 AcceleratedWidget widget) |
| 108 : NativeViewGLSurfaceEGL(ozone_surface->GetNativeWindow()), | 108 : NativeViewGLSurfaceEGL(ozone_surface->GetNativeWindow()), |
| 109 ozone_surface_(std::move(ozone_surface)), | 109 ozone_surface_(std::move(ozone_surface)), |
| 110 widget_(widget) {} | 110 widget_(widget) {} |
| 111 | 111 |
| 112 bool GLSurfaceOzoneEGL::Initialize(gfx::GLSurface::Format format) { | 112 bool GLSurfaceOzoneEGL::Initialize(gfx::GLSurface::Format format) { |
| 113 format_ = format; | 113 format_ = format; |
| 114 return Initialize(ozone_surface_->CreateVSyncProvider()); | 114 return Initialize(ozone_surface_->CreateVSyncProvider()); |
| 115 } | 115 } |
| 116 | 116 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 if (config_) | 152 if (config_) |
| 153 return config_; | 153 return config_; |
| 154 return NativeViewGLSurfaceEGL::GetConfig(); | 154 return NativeViewGLSurfaceEGL::GetConfig(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 GLSurfaceOzoneEGL::~GLSurfaceOzoneEGL() { | 157 GLSurfaceOzoneEGL::~GLSurfaceOzoneEGL() { |
| 158 Destroy(); // The EGL surface must be destroyed before SurfaceOzone. | 158 Destroy(); // The EGL surface must be destroyed before SurfaceOzone. |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool GLSurfaceOzoneEGL::ReinitializeNativeSurface() { | 161 bool GLSurfaceOzoneEGL::ReinitializeNativeSurface() { |
| 162 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; | 162 std::unique_ptr<ui::ScopedMakeCurrent> scoped_make_current; |
| 163 GLContext* current_context = GLContext::GetCurrent(); | 163 GLContext* current_context = GLContext::GetCurrent(); |
| 164 bool was_current = current_context && current_context->IsCurrent(this); | 164 bool was_current = current_context && current_context->IsCurrent(this); |
| 165 if (was_current) { | 165 if (was_current) { |
| 166 scoped_make_current.reset(new ui::ScopedMakeCurrent(current_context, this)); | 166 scoped_make_current.reset(new ui::ScopedMakeCurrent(current_context, this)); |
| 167 } | 167 } |
| 168 | 168 |
| 169 Destroy(); | 169 Destroy(); |
| 170 ozone_surface_ = ui::OzonePlatform::GetInstance() | 170 ozone_surface_ = ui::OzonePlatform::GetInstance() |
| 171 ->GetSurfaceFactoryOzone() | 171 ->GetSurfaceFactoryOzone() |
| 172 ->CreateEGLSurfaceForWidget(widget_); | 172 ->CreateEGLSurfaceForWidget(widget_); |
| 173 if (!ozone_surface_) { | 173 if (!ozone_surface_) { |
| 174 LOG(ERROR) << "Failed to create native surface."; | 174 LOG(ERROR) << "Failed to create native surface."; |
| 175 return false; | 175 return false; |
| 176 } | 176 } |
| 177 | 177 |
| 178 window_ = ozone_surface_->GetNativeWindow(); | 178 window_ = ozone_surface_->GetNativeWindow(); |
| 179 if (!Initialize(format_)) { | 179 if (!Initialize(format_)) { |
| 180 LOG(ERROR) << "Failed to initialize."; | 180 LOG(ERROR) << "Failed to initialize."; |
| 181 return false; | 181 return false; |
| 182 } | 182 } |
| 183 | 183 |
| 184 return true; | 184 return true; |
| 185 } | 185 } |
| 186 | 186 |
| 187 class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL { | 187 class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL { |
| 188 public: | 188 public: |
| 189 GLSurfaceOzoneSurfaceless(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, | 189 GLSurfaceOzoneSurfaceless(std::unique_ptr<ui::SurfaceOzoneEGL> ozone_surface, |
| 190 AcceleratedWidget widget); | 190 AcceleratedWidget widget); |
| 191 | 191 |
| 192 // GLSurface: | 192 // GLSurface: |
| 193 bool Initialize(gfx::GLSurface::Format format) override; | 193 bool Initialize(gfx::GLSurface::Format format) override; |
| 194 bool Resize(const gfx::Size& size, | 194 bool Resize(const gfx::Size& size, |
| 195 float scale_factor, | 195 float scale_factor, |
| 196 bool has_alpha) override; | 196 bool has_alpha) override; |
| 197 gfx::SwapResult SwapBuffers() override; | 197 gfx::SwapResult SwapBuffers() override; |
| 198 bool ScheduleOverlayPlane(int z_order, | 198 bool ScheduleOverlayPlane(int z_order, |
| 199 OverlayTransform transform, | 199 OverlayTransform transform, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 228 | 228 |
| 229 void SubmitFrame(); | 229 void SubmitFrame(); |
| 230 | 230 |
| 231 EGLSyncKHR InsertFence(); | 231 EGLSyncKHR InsertFence(); |
| 232 void FenceRetired(EGLSyncKHR fence, PendingFrame* frame); | 232 void FenceRetired(EGLSyncKHR fence, PendingFrame* frame); |
| 233 | 233 |
| 234 void SwapCompleted(const SwapCompletionCallback& callback, | 234 void SwapCompleted(const SwapCompletionCallback& callback, |
| 235 gfx::SwapResult result); | 235 gfx::SwapResult result); |
| 236 | 236 |
| 237 // The native surface. Deleting this is allowed to free the EGLNativeWindow. | 237 // The native surface. Deleting this is allowed to free the EGLNativeWindow. |
| 238 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; | 238 std::unique_ptr<ui::SurfaceOzoneEGL> ozone_surface_; |
| 239 AcceleratedWidget widget_; | 239 AcceleratedWidget widget_; |
| 240 scoped_ptr<VSyncProvider> vsync_provider_; | 240 std::unique_ptr<VSyncProvider> vsync_provider_; |
| 241 ScopedVector<PendingFrame> unsubmitted_frames_; | 241 ScopedVector<PendingFrame> unsubmitted_frames_; |
| 242 bool has_implicit_external_sync_; | 242 bool has_implicit_external_sync_; |
| 243 bool last_swap_buffers_result_; | 243 bool last_swap_buffers_result_; |
| 244 bool swap_buffers_pending_; | 244 bool swap_buffers_pending_; |
| 245 | 245 |
| 246 base::WeakPtrFactory<GLSurfaceOzoneSurfaceless> weak_factory_; | 246 base::WeakPtrFactory<GLSurfaceOzoneSurfaceless> weak_factory_; |
| 247 | 247 |
| 248 private: | 248 private: |
| 249 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfaceless); | 249 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfaceless); |
| 250 }; | 250 }; |
| 251 | 251 |
| 252 GLSurfaceOzoneSurfaceless::PendingFrame::PendingFrame() : ready(false) {} | 252 GLSurfaceOzoneSurfaceless::PendingFrame::PendingFrame() : ready(false) {} |
| 253 | 253 |
| 254 bool GLSurfaceOzoneSurfaceless::PendingFrame::ScheduleOverlayPlanes( | 254 bool GLSurfaceOzoneSurfaceless::PendingFrame::ScheduleOverlayPlanes( |
| 255 gfx::AcceleratedWidget widget) { | 255 gfx::AcceleratedWidget widget) { |
| 256 for (const auto& overlay : overlays) | 256 for (const auto& overlay : overlays) |
| 257 if (!overlay.ScheduleOverlayPlane(widget)) | 257 if (!overlay.ScheduleOverlayPlane(widget)) |
| 258 return false; | 258 return false; |
| 259 return true; | 259 return true; |
| 260 } | 260 } |
| 261 | 261 |
| 262 GLSurfaceOzoneSurfaceless::GLSurfaceOzoneSurfaceless( | 262 GLSurfaceOzoneSurfaceless::GLSurfaceOzoneSurfaceless( |
| 263 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, | 263 std::unique_ptr<ui::SurfaceOzoneEGL> ozone_surface, |
| 264 AcceleratedWidget widget) | 264 AcceleratedWidget widget) |
| 265 : SurfacelessEGL(gfx::Size()), | 265 : SurfacelessEGL(gfx::Size()), |
| 266 ozone_surface_(std::move(ozone_surface)), | 266 ozone_surface_(std::move(ozone_surface)), |
| 267 widget_(widget), | 267 widget_(widget), |
| 268 has_implicit_external_sync_( | 268 has_implicit_external_sync_( |
| 269 HasEGLExtension("EGL_ARM_implicit_external_sync")), | 269 HasEGLExtension("EGL_ARM_implicit_external_sync")), |
| 270 last_swap_buffers_result_(true), | 270 last_swap_buffers_result_(true), |
| 271 swap_buffers_pending_(false), | 271 swap_buffers_pending_(false), |
| 272 weak_factory_(this) { | 272 weak_factory_(this) { |
| 273 unsubmitted_frames_.push_back(new PendingFrame()); | 273 unsubmitted_frames_.push_back(new PendingFrame()); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 | 415 |
| 416 GLSurfaceOzoneSurfaceless::~GLSurfaceOzoneSurfaceless() { | 416 GLSurfaceOzoneSurfaceless::~GLSurfaceOzoneSurfaceless() { |
| 417 Destroy(); // The EGL surface must be destroyed before SurfaceOzone. | 417 Destroy(); // The EGL surface must be destroyed before SurfaceOzone. |
| 418 } | 418 } |
| 419 | 419 |
| 420 void GLSurfaceOzoneSurfaceless::SubmitFrame() { | 420 void GLSurfaceOzoneSurfaceless::SubmitFrame() { |
| 421 DCHECK(!unsubmitted_frames_.empty()); | 421 DCHECK(!unsubmitted_frames_.empty()); |
| 422 | 422 |
| 423 if (unsubmitted_frames_.front()->ready && !swap_buffers_pending_) { | 423 if (unsubmitted_frames_.front()->ready && !swap_buffers_pending_) { |
| 424 scoped_ptr<PendingFrame> frame(unsubmitted_frames_.front()); | 424 std::unique_ptr<PendingFrame> frame(unsubmitted_frames_.front()); |
| 425 unsubmitted_frames_.weak_erase(unsubmitted_frames_.begin()); | 425 unsubmitted_frames_.weak_erase(unsubmitted_frames_.begin()); |
| 426 swap_buffers_pending_ = true; | 426 swap_buffers_pending_ = true; |
| 427 | 427 |
| 428 if (!frame->ScheduleOverlayPlanes(widget_)) { | 428 if (!frame->ScheduleOverlayPlanes(widget_)) { |
| 429 // |callback| is a wrapper for SwapCompleted(). Call it to properly | 429 // |callback| is a wrapper for SwapCompleted(). Call it to properly |
| 430 // propagate the failed state. | 430 // propagate the failed state. |
| 431 frame->callback.Run(gfx::SwapResult::SWAP_FAILED); | 431 frame->callback.Run(gfx::SwapResult::SWAP_FAILED); |
| 432 return; | 432 return; |
| 433 } | 433 } |
| 434 | 434 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 465 | 465 |
| 466 SubmitFrame(); | 466 SubmitFrame(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 // This provides surface-like semantics implemented through surfaceless. | 469 // This provides surface-like semantics implemented through surfaceless. |
| 470 // A framebuffer is bound automatically. | 470 // A framebuffer is bound automatically. |
| 471 class GL_EXPORT GLSurfaceOzoneSurfacelessSurfaceImpl | 471 class GL_EXPORT GLSurfaceOzoneSurfacelessSurfaceImpl |
| 472 : public GLSurfaceOzoneSurfaceless { | 472 : public GLSurfaceOzoneSurfaceless { |
| 473 public: | 473 public: |
| 474 GLSurfaceOzoneSurfacelessSurfaceImpl( | 474 GLSurfaceOzoneSurfacelessSurfaceImpl( |
| 475 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, | 475 std::unique_ptr<ui::SurfaceOzoneEGL> ozone_surface, |
| 476 AcceleratedWidget widget); | 476 AcceleratedWidget widget); |
| 477 | 477 |
| 478 // GLSurface: | 478 // GLSurface: |
| 479 unsigned int GetBackingFrameBufferObject() override; | 479 unsigned int GetBackingFrameBufferObject() override; |
| 480 bool OnMakeCurrent(GLContext* context) override; | 480 bool OnMakeCurrent(GLContext* context) override; |
| 481 bool Resize(const gfx::Size& size, | 481 bool Resize(const gfx::Size& size, |
| 482 float scale_factor, | 482 float scale_factor, |
| 483 bool has_alpha) override; | 483 bool has_alpha) override; |
| 484 bool SupportsPostSubBuffer() override; | 484 bool SupportsPostSubBuffer() override; |
| 485 gfx::SwapResult SwapBuffers() override; | 485 gfx::SwapResult SwapBuffers() override; |
| 486 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; | 486 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
| 487 void Destroy() override; | 487 void Destroy() override; |
| 488 bool IsSurfaceless() const override; | 488 bool IsSurfaceless() const override; |
| 489 | 489 |
| 490 private: | 490 private: |
| 491 ~GLSurfaceOzoneSurfacelessSurfaceImpl() override; | 491 ~GLSurfaceOzoneSurfacelessSurfaceImpl() override; |
| 492 | 492 |
| 493 void BindFramebuffer(); | 493 void BindFramebuffer(); |
| 494 bool CreatePixmaps(); | 494 bool CreatePixmaps(); |
| 495 | 495 |
| 496 scoped_refptr<GLContext> context_; | 496 scoped_refptr<GLContext> context_; |
| 497 GLuint fbo_; | 497 GLuint fbo_; |
| 498 GLuint textures_[2]; | 498 GLuint textures_[2]; |
| 499 scoped_refptr<GLImage> images_[2]; | 499 scoped_refptr<GLImage> images_[2]; |
| 500 int current_surface_; | 500 int current_surface_; |
| 501 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfacelessSurfaceImpl); | 501 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfacelessSurfaceImpl); |
| 502 }; | 502 }; |
| 503 | 503 |
| 504 GLSurfaceOzoneSurfacelessSurfaceImpl::GLSurfaceOzoneSurfacelessSurfaceImpl( | 504 GLSurfaceOzoneSurfacelessSurfaceImpl::GLSurfaceOzoneSurfacelessSurfaceImpl( |
| 505 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, | 505 std::unique_ptr<ui::SurfaceOzoneEGL> ozone_surface, |
| 506 AcceleratedWidget widget) | 506 AcceleratedWidget widget) |
| 507 : GLSurfaceOzoneSurfaceless(std::move(ozone_surface), widget), | 507 : GLSurfaceOzoneSurfaceless(std::move(ozone_surface), widget), |
| 508 context_(nullptr), | 508 context_(nullptr), |
| 509 fbo_(0), | 509 fbo_(0), |
| 510 current_surface_(0) { | 510 current_surface_(0) { |
| 511 for (auto& texture : textures_) | 511 for (auto& texture : textures_) |
| 512 texture = 0; | 512 texture = 0; |
| 513 } | 513 } |
| 514 | 514 |
| 515 unsigned int | 515 unsigned int |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 // Bind image to texture. | 646 // Bind image to texture. |
| 647 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); | 647 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); |
| 648 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) | 648 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) |
| 649 return false; | 649 return false; |
| 650 } | 650 } |
| 651 return true; | 651 return true; |
| 652 } | 652 } |
| 653 | 653 |
| 654 scoped_refptr<GLSurface> CreateViewGLSurfaceOzone( | 654 scoped_refptr<GLSurface> CreateViewGLSurfaceOzone( |
| 655 gfx::AcceleratedWidget window) { | 655 gfx::AcceleratedWidget window) { |
| 656 scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone = | 656 std::unique_ptr<ui::SurfaceOzoneEGL> surface_ozone = |
| 657 ui::OzonePlatform::GetInstance() | 657 ui::OzonePlatform::GetInstance() |
| 658 ->GetSurfaceFactoryOzone() | 658 ->GetSurfaceFactoryOzone() |
| 659 ->CreateEGLSurfaceForWidget(window); | 659 ->CreateEGLSurfaceForWidget(window); |
| 660 if (!surface_ozone) | 660 if (!surface_ozone) |
| 661 return nullptr; | 661 return nullptr; |
| 662 scoped_refptr<GLSurface> surface = | 662 scoped_refptr<GLSurface> surface = |
| 663 new GLSurfaceOzoneEGL(std::move(surface_ozone), window); | 663 new GLSurfaceOzoneEGL(std::move(surface_ozone), window); |
| 664 if (!surface->Initialize()) | 664 if (!surface->Initialize()) |
| 665 return nullptr; | 665 return nullptr; |
| 666 return surface; | 666 return surface; |
| 667 } | 667 } |
| 668 | 668 |
| 669 scoped_refptr<GLSurface> CreateViewGLSurfaceOzoneSurfacelessSurfaceImpl( | 669 scoped_refptr<GLSurface> CreateViewGLSurfaceOzoneSurfacelessSurfaceImpl( |
| 670 gfx::AcceleratedWidget window) { | 670 gfx::AcceleratedWidget window) { |
| 671 scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone = | 671 std::unique_ptr<ui::SurfaceOzoneEGL> surface_ozone = |
| 672 ui::OzonePlatform::GetInstance() | 672 ui::OzonePlatform::GetInstance() |
| 673 ->GetSurfaceFactoryOzone() | 673 ->GetSurfaceFactoryOzone() |
| 674 ->CreateSurfacelessEGLSurfaceForWidget(window); | 674 ->CreateSurfacelessEGLSurfaceForWidget(window); |
| 675 if (!surface_ozone) | 675 if (!surface_ozone) |
| 676 return nullptr; | 676 return nullptr; |
| 677 scoped_refptr<GLSurface> surface = new GLSurfaceOzoneSurfacelessSurfaceImpl( | 677 scoped_refptr<GLSurface> surface = new GLSurfaceOzoneSurfacelessSurfaceImpl( |
| 678 std::move(surface_ozone), window); | 678 std::move(surface_ozone), window); |
| 679 if (!surface->Initialize()) | 679 if (!surface->Initialize()) |
| 680 return nullptr; | 680 return nullptr; |
| 681 return surface; | 681 return surface; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 700 return false; | 700 return false; |
| 701 } | 701 } |
| 702 } | 702 } |
| 703 | 703 |
| 704 // static | 704 // static |
| 705 scoped_refptr<GLSurface> GLSurface::CreateSurfacelessViewGLSurface( | 705 scoped_refptr<GLSurface> GLSurface::CreateSurfacelessViewGLSurface( |
| 706 gfx::AcceleratedWidget window) { | 706 gfx::AcceleratedWidget window) { |
| 707 if (GetGLImplementation() == kGLImplementationEGLGLES2 && | 707 if (GetGLImplementation() == kGLImplementationEGLGLES2 && |
| 708 window != kNullAcceleratedWidget && | 708 window != kNullAcceleratedWidget && |
| 709 GLSurfaceEGL::IsEGLSurfacelessContextSupported()) { | 709 GLSurfaceEGL::IsEGLSurfacelessContextSupported()) { |
| 710 scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone = | 710 std::unique_ptr<ui::SurfaceOzoneEGL> surface_ozone = |
| 711 ui::OzonePlatform::GetInstance() | 711 ui::OzonePlatform::GetInstance() |
| 712 ->GetSurfaceFactoryOzone() | 712 ->GetSurfaceFactoryOzone() |
| 713 ->CreateSurfacelessEGLSurfaceForWidget(window); | 713 ->CreateSurfacelessEGLSurfaceForWidget(window); |
| 714 if (!surface_ozone) | 714 if (!surface_ozone) |
| 715 return nullptr; | 715 return nullptr; |
| 716 scoped_refptr<GLSurface> surface; | 716 scoped_refptr<GLSurface> surface; |
| 717 surface = new GLSurfaceOzoneSurfaceless(std::move(surface_ozone), window); | 717 surface = new GLSurfaceOzoneSurfaceless(std::move(surface_ozone), window); |
| 718 if (surface->Initialize()) | 718 if (surface->Initialize()) |
| 719 return surface; | 719 return surface; |
| 720 } | 720 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 } | 780 } |
| 781 } | 781 } |
| 782 | 782 |
| 783 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 783 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 784 return ui::OzonePlatform::GetInstance() | 784 return ui::OzonePlatform::GetInstance() |
| 785 ->GetSurfaceFactoryOzone() | 785 ->GetSurfaceFactoryOzone() |
| 786 ->GetNativeDisplay(); | 786 ->GetNativeDisplay(); |
| 787 } | 787 } |
| 788 | 788 |
| 789 } // namespace gfx | 789 } // namespace gfx |
| OLD | NEW |