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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_x11.cc

Issue 649533003: C++11 declares a type safe null pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Presubmit errors Created 6 years, 2 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
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 "content/common/gpu/gpu_memory_buffer_factory.h" 5 #include "content/common/gpu/gpu_memory_buffer_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.h" 8 #include "content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.h"
9 #include "ui/gl/gl_image.h" 9 #include "ui/gl/gl_image.h"
10 #include "ui/gl/gl_image_shared_memory.h" 10 #include "ui/gl/gl_image_shared_memory.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( 44 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
45 const gfx::GpuMemoryBufferHandle& handle, 45 const gfx::GpuMemoryBufferHandle& handle,
46 const gfx::Size& size, 46 const gfx::Size& size,
47 unsigned internalformat, 47 unsigned internalformat,
48 int client_id) override { 48 int client_id) override {
49 switch (handle.type) { 49 switch (handle.type) {
50 case gfx::SHARED_MEMORY_BUFFER: { 50 case gfx::SHARED_MEMORY_BUFFER: {
51 scoped_refptr<gfx::GLImageSharedMemory> image( 51 scoped_refptr<gfx::GLImageSharedMemory> image(
52 new gfx::GLImageSharedMemory(size, internalformat)); 52 new gfx::GLImageSharedMemory(size, internalformat));
53 if (!image->Initialize(handle)) 53 if (!image->Initialize(handle))
54 return NULL; 54 return nullptr;
55 55
56 return image; 56 return image;
57 } 57 }
58 case gfx::X11_PIXMAP_BUFFER: 58 case gfx::X11_PIXMAP_BUFFER:
59 // Verify that client is the owner of the buffer we're about to use. 59 // Verify that client is the owner of the buffer we're about to use.
60 if (handle.global_id.secondary_id != client_id) 60 if (handle.global_id.secondary_id != client_id)
61 return scoped_refptr<gfx::GLImage>(); 61 return scoped_refptr<gfx::GLImage>();
62 62
63 return x11_pixmap_factory_.CreateImageForGpuMemoryBuffer( 63 return x11_pixmap_factory_.CreateImageForGpuMemoryBuffer(
64 handle.global_id, size, internalformat); 64 handle.global_id, size, internalformat);
65 default: 65 default:
66 NOTREACHED(); 66 NOTREACHED();
67 return scoped_refptr<gfx::GLImage>(); 67 return scoped_refptr<gfx::GLImage>();
68 } 68 }
69 } 69 }
70 70
71 private: 71 private:
72 GpuMemoryBufferFactoryX11Pixmap x11_pixmap_factory_; 72 GpuMemoryBufferFactoryX11Pixmap x11_pixmap_factory_;
73 }; 73 };
74 74
75 } // namespace 75 } // namespace
76 76
77 // static 77 // static
78 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create() { 78 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create() {
79 return make_scoped_ptr<GpuMemoryBufferFactory>( 79 return make_scoped_ptr<GpuMemoryBufferFactory>(
80 new GpuMemoryBufferFactoryImpl); 80 new GpuMemoryBufferFactoryImpl);
81 } 81 }
82 82
83 } // namespace content 83 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_win.cc ('k') | content/common/gpu/gpu_memory_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698