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

Side by Side Diff: mojo/gles2/command_buffer_client_impl.cc

Issue 1416373010: Implement a MusBrowserFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome
Patch Set: . Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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 "mojo/gles2/command_buffer_client_impl.h" 5 #include "mojo/gles2/command_buffer_client_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
11 #include "base/threading/thread_restrictions.h"
11 #include "components/mus/gles2/command_buffer_type_conversions.h" 12 #include "components/mus/gles2/command_buffer_type_conversions.h"
12 #include "components/mus/gles2/mojo_buffer_backing.h" 13 #include "components/mus/gles2/mojo_buffer_backing.h"
13 #include "components/mus/gles2/mojo_gpu_memory_buffer.h" 14 #include "components/mus/gles2/mojo_gpu_memory_buffer.h"
14 #include "gpu/command_buffer/service/image_factory.h" 15 #include "gpu/command_buffer/service/image_factory.h"
15 #include "mojo/platform_handle/platform_handle_functions.h" 16 #include "mojo/platform_handle/platform_handle_functions.h"
16 17
17 namespace gles2 { 18 namespace gles2 {
18 19
19 namespace { 20 namespace {
20 21
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 command_buffer_.Bind(mojo::InterfacePtrInfo<mus::mojom::CommandBuffer>( 135 command_buffer_.Bind(mojo::InterfacePtrInfo<mus::mojom::CommandBuffer>(
135 command_buffer_handle.Pass(), 0u), 136 command_buffer_handle.Pass(), 0u),
136 async_waiter); 137 async_waiter);
137 command_buffer_.set_connection_error_handler( 138 command_buffer_.set_connection_error_handler(
138 [this]() { DidLoseContext(gpu::error::kUnknown); }); 139 [this]() { DidLoseContext(gpu::error::kUnknown); });
139 } 140 }
140 141
141 CommandBufferClientImpl::~CommandBufferClientImpl() {} 142 CommandBufferClientImpl::~CommandBufferClientImpl() {}
142 143
143 bool CommandBufferClientImpl::Initialize() { 144 bool CommandBufferClientImpl::Initialize() {
145 base::ThreadRestrictions::ScopedAllowWait wait;
146
144 const size_t kSharedStateSize = sizeof(gpu::CommandBufferSharedState); 147 const size_t kSharedStateSize = sizeof(gpu::CommandBufferSharedState);
145 void* memory = NULL; 148 void* memory = NULL;
146 mojo::ScopedSharedBufferHandle duped; 149 mojo::ScopedSharedBufferHandle duped;
147 bool result = CreateMapAndDupSharedBuffer( 150 bool result = CreateMapAndDupSharedBuffer(
148 kSharedStateSize, &memory, &shared_state_handle_, &duped); 151 kSharedStateSize, &memory, &shared_state_handle_, &duped);
149 if (!result) 152 if (!result)
150 return false; 153 return false;
151 154
152 shared_state_ = static_cast<gpu::CommandBufferSharedState*>(memory); 155 shared_state_ = static_cast<gpu::CommandBufferSharedState*>(memory);
153 156
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 gfx::Size(static_cast<int>(width), static_cast<int>(height)), 325 gfx::Size(static_cast<int>(width), static_cast<int>(height)),
323 gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), 326 gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat),
324 gfx::BufferUsage::SCANOUT)); 327 gfx::BufferUsage::SCANOUT));
325 if (!buffer) 328 if (!buffer)
326 return -1; 329 return -1;
327 330
328 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); 331 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
329 } 332 }
330 333
331 uint32_t CommandBufferClientImpl::InsertSyncPoint() { 334 uint32_t CommandBufferClientImpl::InsertSyncPoint() {
335 base::ThreadRestrictions::ScopedAllowWait wait;
332 command_buffer_->InsertSyncPoint(true); 336 command_buffer_->InsertSyncPoint(true);
333 return sync_point_client_impl_->WaitForInsertSyncPoint(); 337 return sync_point_client_impl_->WaitForInsertSyncPoint();
334 } 338 }
335 339
336 uint32_t CommandBufferClientImpl::InsertFutureSyncPoint() { 340 uint32_t CommandBufferClientImpl::InsertFutureSyncPoint() {
337 command_buffer_->InsertSyncPoint(false); 341 command_buffer_->InsertSyncPoint(false);
338 return sync_point_client_impl_->WaitForInsertSyncPoint(); 342 return sync_point_client_impl_->WaitForInsertSyncPoint();
339 } 343 }
340 344
341 void CommandBufferClientImpl::RetireSyncPoint(uint32_t sync_point) { 345 void CommandBufferClientImpl::RetireSyncPoint(uint32_t sync_point) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 // TODO(dyen) 437 // TODO(dyen)
434 } 438 }
435 439
436 bool CommandBufferClientImpl::CanWaitUnverifiedSyncToken( 440 bool CommandBufferClientImpl::CanWaitUnverifiedSyncToken(
437 const gpu::SyncToken* sync_token) { 441 const gpu::SyncToken* sync_token) {
438 // All sync tokens must be flushed before being waited on. 442 // All sync tokens must be flushed before being waited on.
439 return false; 443 return false;
440 } 444 }
441 445
442 } // namespace gles2 446 } // namespace gles2
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/native_browser_frame_factory_chromeos.cc ('k') | ui/views/mus/native_widget_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698