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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 years, 8 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 (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 "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <memory>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
16 #include "gpu/command_buffer/common/gles2_cmd_format.h" 17 #include "gpu/command_buffer/common/gles2_cmd_format.h"
17 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 18 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
18 #include "gpu/command_buffer/common/value_state.h" 19 #include "gpu/command_buffer/common/value_state.h"
19 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 20 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
20 #include "gpu/command_buffer/service/context_group.h" 21 #include "gpu/command_buffer/service/context_group.h"
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 SetBucketData(bucket_id, str, str ? (strlen(str) + 1) : 0); 641 SetBucketData(bucket_id, str, str ? (strlen(str) + 1) : 0);
641 } 642 }
642 643
643 void GLES2DecoderTestBase::SetBucketAsCStrings(uint32_t bucket_id, 644 void GLES2DecoderTestBase::SetBucketAsCStrings(uint32_t bucket_id,
644 GLsizei count, 645 GLsizei count,
645 const char** str, 646 const char** str,
646 GLsizei count_in_header, 647 GLsizei count_in_header,
647 char str_end) { 648 char str_end) {
648 uint32_t header_size = sizeof(GLint) * (count + 1); 649 uint32_t header_size = sizeof(GLint) * (count + 1);
649 uint32_t total_size = header_size; 650 uint32_t total_size = header_size;
650 scoped_ptr<GLint[]> header(new GLint[count + 1]); 651 std::unique_ptr<GLint[]> header(new GLint[count + 1]);
651 header[0] = static_cast<GLint>(count_in_header); 652 header[0] = static_cast<GLint>(count_in_header);
652 for (GLsizei ii = 0; ii < count; ++ii) { 653 for (GLsizei ii = 0; ii < count; ++ii) {
653 header[ii + 1] = str && str[ii] ? strlen(str[ii]) : 0; 654 header[ii + 1] = str && str[ii] ? strlen(str[ii]) : 0;
654 total_size += header[ii + 1] + 1; 655 total_size += header[ii + 1] + 1;
655 } 656 }
656 cmd::SetBucketSize cmd1; 657 cmd::SetBucketSize cmd1;
657 cmd1.Init(bucket_id, total_size); 658 cmd1.Init(bucket_id, total_size);
658 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); 659 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1));
659 memcpy(shared_memory_address_, header.get(), header_size); 660 memcpy(shared_memory_address_, header.get(), header_size);
660 uint32_t offset = header_size; 661 uint32_t offset = header_size;
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1982 .Times(1) 1983 .Times(1)
1983 .RetiresOnSaturation(); 1984 .RetiresOnSaturation();
1984 EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0)) 1985 EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0))
1985 .Times(1) 1986 .Times(1)
1986 .RetiresOnSaturation(); 1987 .RetiresOnSaturation();
1987 } 1988 }
1988 } 1989 }
1989 1990
1990 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: 1991 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine::
1991 MockCommandBufferEngine() { 1992 MockCommandBufferEngine() {
1992 1993 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory());
1993 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
1994 shm->CreateAndMapAnonymous(kSharedBufferSize); 1994 shm->CreateAndMapAnonymous(kSharedBufferSize);
1995 valid_buffer_ = MakeBufferFromSharedMemory(std::move(shm), kSharedBufferSize); 1995 valid_buffer_ = MakeBufferFromSharedMemory(std::move(shm), kSharedBufferSize);
1996 1996
1997 ClearSharedMemory(); 1997 ClearSharedMemory();
1998 } 1998 }
1999 1999
2000 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: 2000 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine::
2001 ~MockCommandBufferEngine() {} 2001 ~MockCommandBufferEngine() {}
2002 2002
2003 scoped_refptr<gpu::Buffer> 2003 scoped_refptr<gpu::Buffer>
(...skipping 30 matching lines...) Expand all
2034 SetupDefaultProgram(); 2034 SetupDefaultProgram();
2035 } 2035 }
2036 2036
2037 // Include the auto-generated part of this file. We split this because it means 2037 // Include the auto-generated part of this file. We split this because it means
2038 // we can easily edit the non-auto generated parts right here in this file 2038 // we can easily edit the non-auto generated parts right here in this file
2039 // instead of having to edit some template or the code generator. 2039 // instead of having to edit some template or the code generator.
2040 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" 2040 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h"
2041 2041
2042 } // namespace gles2 2042 } // namespace gles2
2043 } // namespace gpu 2043 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698