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

Side by Side Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 255713008: Change glimage to accept a type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/gpu/browser_gpu_channel_host_factory.h" 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 gpu_host_id_ = pending_request_->gpu_host_id(); 369 gpu_host_id_ = pending_request_->gpu_host_id();
370 pending_request_ = NULL; 370 pending_request_ = NULL;
371 371
372 for (size_t n = 0; n < established_callbacks_.size(); n++) 372 for (size_t n = 0; n < established_callbacks_.size(); n++)
373 established_callbacks_[n].Run(); 373 established_callbacks_[n].Run();
374 374
375 established_callbacks_.clear(); 375 established_callbacks_.clear();
376 } 376 }
377 377
378 scoped_ptr<gfx::GpuMemoryBuffer> 378 scoped_ptr<gfx::GpuMemoryBuffer>
379 BrowserGpuChannelHostFactory::AllocateGpuMemoryBuffer( 379 BrowserGpuChannelHostFactory::AllocateGpuMemoryBuffer(size_t width,
380 size_t width, 380 size_t height,
381 size_t height, 381 unsigned internalformat,
382 unsigned internalformat) { 382 unsigned usage) {
383 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) 383 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat) ||
384 !GpuMemoryBufferImpl::IsUsageValid(usage))
384 return scoped_ptr<gfx::GpuMemoryBuffer>(); 385 return scoped_ptr<gfx::GpuMemoryBuffer>();
385 386
386 size_t size = width * height * 387 size_t size = width * height *
387 GpuMemoryBufferImpl::BytesPerPixel(internalformat); 388 GpuMemoryBufferImpl::BytesPerPixel(internalformat);
388 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory()); 389 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
389 if (!shm->CreateAnonymous(size)) 390 if (!shm->CreateAnonymous(size))
390 return scoped_ptr<gfx::GpuMemoryBuffer>(); 391 return scoped_ptr<gfx::GpuMemoryBuffer>();
391 392
392 scoped_ptr<GpuMemoryBufferImplShm> buffer( 393 scoped_ptr<GpuMemoryBufferImplShm> buffer(
393 new GpuMemoryBufferImplShm(gfx::Size(width, height), internalformat)); 394 new GpuMemoryBufferImplShm(gfx::Size(width, height), internalformat));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 filter->AddRoute(MSG_ROUTING_CONTROL, handler); 426 filter->AddRoute(MSG_ROUTING_CONTROL, handler);
426 427
427 GetIOLoopProxy()->PostTask( 428 GetIOLoopProxy()->PostTask(
428 FROM_HERE, 429 FROM_HERE,
429 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO, 430 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO,
430 gpu_host_id_, 431 gpu_host_id_,
431 filter)); 432 filter));
432 } 433 }
433 434
434 } // namespace content 435 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698