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

Unified Diff: mojo/services/native_viewport/native_viewport_impl.cc

Issue 451753003: Mojo multiple command buffer support and sample (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better casts Created 6 years, 4 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
« no previous file with comments | « mojo/services/native_viewport/native_viewport_impl.h ('k') | mojo/services/public/interfaces/gpu/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/native_viewport_impl.cc
diff --git a/mojo/services/native_viewport/native_viewport_impl.cc b/mojo/services/native_viewport/native_viewport_impl.cc
index 8755dfd1c74b8f2dc5274e50698b51d89dfff11b..0b871dc33845e9bc335f7ccecb4715d447585f1d 100644
--- a/mojo/services/native_viewport/native_viewport_impl.cc
+++ b/mojo/services/native_viewport/native_viewport_impl.cc
@@ -4,6 +4,7 @@
#include "mojo/services/native_viewport/native_viewport_impl.h"
+#include "base/bind.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/time/time.h"
@@ -38,7 +39,6 @@ NativeViewportImpl::~NativeViewportImpl() {
void NativeViewportImpl::Create(RectPtr bounds) {
platform_viewport_ = PlatformViewport::Create(this);
platform_viewport_->Init(bounds.To<gfx::Rect>());
- client()->OnCreated();
OnBoundsChanged(bounds.To<gfx::Rect>());
}
@@ -51,7 +51,6 @@ void NativeViewportImpl::Hide() {
}
void NativeViewportImpl::Close() {
- command_buffer_.reset();
DCHECK(platform_viewport_);
platform_viewport_->Close();
}
@@ -60,25 +59,15 @@ void NativeViewportImpl::SetBounds(RectPtr bounds) {
platform_viewport_->SetBounds(bounds.To<gfx::Rect>());
}
-void NativeViewportImpl::CreateGLES2Context(
- InterfaceRequest<CommandBuffer> command_buffer_request) {
- if (command_buffer_ || command_buffer_request_.is_pending()) {
- LOG(ERROR) << "Can't create multiple contexts on a NativeViewport";
- return;
- }
- command_buffer_request_ = command_buffer_request.Pass();
- CreateCommandBufferIfNeeded();
-}
-
void NativeViewportImpl::OnBoundsChanged(const gfx::Rect& bounds) {
- CreateCommandBufferIfNeeded();
client()->OnBoundsChanged(Rect::From(bounds));
}
void NativeViewportImpl::OnAcceleratedWidgetAvailable(
gfx::AcceleratedWidget widget) {
widget_ = widget;
- CreateCommandBufferIfNeeded();
+ uintptr_t widget_ptr = bit_cast<uintptr_t>(widget);
+ client()->OnCreated(static_cast<uint64_t>(widget_ptr));
}
bool NativeViewportImpl::OnEvent(ui::Event* ui_event) {
@@ -108,31 +97,12 @@ bool NativeViewportImpl::OnEvent(ui::Event* ui_event) {
}
void NativeViewportImpl::OnDestroyed() {
- client()->OnDestroyed(base::Bind(&NativeViewportImpl::AckDestroyed,
- base::Unretained(this)));
+ client()->OnDestroyed();
}
void NativeViewportImpl::AckEvent() {
waiting_for_event_ack_ = false;
}
-void NativeViewportImpl::CreateCommandBufferIfNeeded() {
- if (!command_buffer_request_.is_pending())
- return;
- DCHECK(!command_buffer_.get());
- if (widget_ == gfx::kNullAcceleratedWidget)
- return;
- gfx::Size size = platform_viewport_->GetSize();
- if (size.IsEmpty())
- return;
- command_buffer_.reset(
- new CommandBufferImpl(widget_, platform_viewport_->GetSize()));
- WeakBindToRequest(command_buffer_.get(), &command_buffer_request_);
-}
-
-void NativeViewportImpl::AckDestroyed() {
- command_buffer_.reset();
-}
-
} // namespace mojo
« no previous file with comments | « mojo/services/native_viewport/native_viewport_impl.h ('k') | mojo/services/public/interfaces/gpu/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698