| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "gpu/ipc/common/gpu_messages.h" | 7 #include "gpu/ipc/common/gpu_messages.h" |
| 8 #include "gpu/ipc/service/gpu_channel.h" | 8 #include "gpu/ipc/service/gpu_channel.h" |
| 9 #include "gpu/ipc/service/gpu_channel_test_common.h" | 9 #include "gpu/ipc/service/gpu_channel_test_common.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 ASSERT_TRUE(channel); | 25 ASSERT_TRUE(channel); |
| 26 | 26 |
| 27 SurfaceHandle surface_handle = kFakeSurfaceHandle; | 27 SurfaceHandle surface_handle = kFakeSurfaceHandle; |
| 28 DCHECK_NE(surface_handle, kNullSurfaceHandle); | 28 DCHECK_NE(surface_handle, kNullSurfaceHandle); |
| 29 | 29 |
| 30 int32_t kRouteId = 1; | 30 int32_t kRouteId = 1; |
| 31 GPUCreateCommandBufferConfig init_params; | 31 GPUCreateCommandBufferConfig init_params; |
| 32 init_params.surface_handle = surface_handle; | 32 init_params.surface_handle = surface_handle; |
| 33 init_params.share_group_id = MSG_ROUTING_NONE; | 33 init_params.share_group_id = MSG_ROUTING_NONE; |
| 34 init_params.stream_id = 0; | 34 init_params.stream_id = 0; |
| 35 init_params.stream_priority = SchedulingPriority::kNormal; | 35 init_params.stream_priority = GpuStreamPriority::NORMAL; |
| 36 init_params.attribs = gles2::ContextCreationAttribHelper(); | 36 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 37 init_params.active_url = GURL(); | 37 init_params.active_url = GURL(); |
| 38 bool result = false; | 38 bool result = false; |
| 39 gpu::Capabilities capabilities; | 39 gpu::Capabilities capabilities; |
| 40 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 40 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 41 init_params, kRouteId, GetSharedHandle(), &result, | 41 init_params, kRouteId, GetSharedHandle(), &result, |
| 42 &capabilities)); | 42 &capabilities)); |
| 43 EXPECT_TRUE(result); | 43 EXPECT_TRUE(result); |
| 44 | 44 |
| 45 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 45 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
| 46 ASSERT_TRUE(stub); | 46 ASSERT_TRUE(stub); |
| 47 } | 47 } |
| 48 | 48 |
| 49 TEST_F(GpuChannelTest, CreateViewCommandBufferDisallowed) { | 49 TEST_F(GpuChannelTest, CreateViewCommandBufferDisallowed) { |
| 50 int32_t kClientId = 1; | 50 int32_t kClientId = 1; |
| 51 bool is_gpu_host = false; | 51 bool is_gpu_host = false; |
| 52 GpuChannel* channel = CreateChannel(kClientId, is_gpu_host); | 52 GpuChannel* channel = CreateChannel(kClientId, is_gpu_host); |
| 53 ASSERT_TRUE(channel); | 53 ASSERT_TRUE(channel); |
| 54 | 54 |
| 55 SurfaceHandle surface_handle = kFakeSurfaceHandle; | 55 SurfaceHandle surface_handle = kFakeSurfaceHandle; |
| 56 DCHECK_NE(surface_handle, kNullSurfaceHandle); | 56 DCHECK_NE(surface_handle, kNullSurfaceHandle); |
| 57 | 57 |
| 58 int32_t kRouteId = 1; | 58 int32_t kRouteId = 1; |
| 59 GPUCreateCommandBufferConfig init_params; | 59 GPUCreateCommandBufferConfig init_params; |
| 60 init_params.surface_handle = surface_handle; | 60 init_params.surface_handle = surface_handle; |
| 61 init_params.share_group_id = MSG_ROUTING_NONE; | 61 init_params.share_group_id = MSG_ROUTING_NONE; |
| 62 init_params.stream_id = 0; | 62 init_params.stream_id = 0; |
| 63 init_params.stream_priority = SchedulingPriority::kNormal; | 63 init_params.stream_priority = GpuStreamPriority::NORMAL; |
| 64 init_params.attribs = gles2::ContextCreationAttribHelper(); | 64 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 65 init_params.active_url = GURL(); | 65 init_params.active_url = GURL(); |
| 66 bool result = false; | 66 bool result = false; |
| 67 gpu::Capabilities capabilities; | 67 gpu::Capabilities capabilities; |
| 68 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 68 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 69 init_params, kRouteId, GetSharedHandle(), &result, | 69 init_params, kRouteId, GetSharedHandle(), &result, |
| 70 &capabilities)); | 70 &capabilities)); |
| 71 EXPECT_FALSE(result); | 71 EXPECT_FALSE(result); |
| 72 | 72 |
| 73 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 73 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
| 74 EXPECT_FALSE(stub); | 74 EXPECT_FALSE(stub); |
| 75 } | 75 } |
| 76 | 76 |
| 77 TEST_F(GpuChannelTest, CreateOffscreenCommandBuffer) { | 77 TEST_F(GpuChannelTest, CreateOffscreenCommandBuffer) { |
| 78 int32_t kClientId = 1; | 78 int32_t kClientId = 1; |
| 79 GpuChannel* channel = CreateChannel(kClientId, true); | 79 GpuChannel* channel = CreateChannel(kClientId, true); |
| 80 ASSERT_TRUE(channel); | 80 ASSERT_TRUE(channel); |
| 81 | 81 |
| 82 int32_t kRouteId = 1; | 82 int32_t kRouteId = 1; |
| 83 GPUCreateCommandBufferConfig init_params; | 83 GPUCreateCommandBufferConfig init_params; |
| 84 init_params.surface_handle = kNullSurfaceHandle; | 84 init_params.surface_handle = kNullSurfaceHandle; |
| 85 init_params.share_group_id = MSG_ROUTING_NONE; | 85 init_params.share_group_id = MSG_ROUTING_NONE; |
| 86 init_params.stream_id = 0; | 86 init_params.stream_id = 0; |
| 87 init_params.stream_priority = SchedulingPriority::kNormal; | 87 init_params.stream_priority = GpuStreamPriority::NORMAL; |
| 88 init_params.attribs = gles2::ContextCreationAttribHelper(); | 88 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 89 init_params.active_url = GURL(); | 89 init_params.active_url = GURL(); |
| 90 bool result = false; | 90 bool result = false; |
| 91 gpu::Capabilities capabilities; | 91 gpu::Capabilities capabilities; |
| 92 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 92 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 93 init_params, kRouteId, GetSharedHandle(), &result, | 93 init_params, kRouteId, GetSharedHandle(), &result, |
| 94 &capabilities)); | 94 &capabilities)); |
| 95 EXPECT_TRUE(result); | 95 EXPECT_TRUE(result); |
| 96 | 96 |
| 97 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 97 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
| 98 EXPECT_TRUE(stub); | 98 EXPECT_TRUE(stub); |
| 99 } | 99 } |
| 100 | 100 |
| 101 TEST_F(GpuChannelTest, IncompatibleStreamIds) { | 101 TEST_F(GpuChannelTest, IncompatibleStreamIds) { |
| 102 int32_t kClientId = 1; | 102 int32_t kClientId = 1; |
| 103 GpuChannel* channel = CreateChannel(kClientId, true); | 103 GpuChannel* channel = CreateChannel(kClientId, true); |
| 104 ASSERT_TRUE(channel); | 104 ASSERT_TRUE(channel); |
| 105 | 105 |
| 106 // Create first context. | 106 // Create first context. |
| 107 int32_t kRouteId1 = 1; | 107 int32_t kRouteId1 = 1; |
| 108 int32_t kStreamId1 = 1; | 108 int32_t kStreamId1 = 1; |
| 109 GPUCreateCommandBufferConfig init_params; | 109 GPUCreateCommandBufferConfig init_params; |
| 110 init_params.surface_handle = kNullSurfaceHandle; | 110 init_params.surface_handle = kNullSurfaceHandle; |
| 111 init_params.share_group_id = MSG_ROUTING_NONE; | 111 init_params.share_group_id = MSG_ROUTING_NONE; |
| 112 init_params.stream_id = kStreamId1; | 112 init_params.stream_id = kStreamId1; |
| 113 init_params.stream_priority = SchedulingPriority::kNormal; | 113 init_params.stream_priority = GpuStreamPriority::NORMAL; |
| 114 init_params.attribs = gles2::ContextCreationAttribHelper(); | 114 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 115 init_params.active_url = GURL(); | 115 init_params.active_url = GURL(); |
| 116 bool result = false; | 116 bool result = false; |
| 117 gpu::Capabilities capabilities; | 117 gpu::Capabilities capabilities; |
| 118 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 118 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 119 init_params, kRouteId1, GetSharedHandle(), &result, | 119 init_params, kRouteId1, GetSharedHandle(), &result, |
| 120 &capabilities)); | 120 &capabilities)); |
| 121 EXPECT_TRUE(result); | 121 EXPECT_TRUE(result); |
| 122 | 122 |
| 123 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1); | 123 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1); |
| 124 EXPECT_TRUE(stub); | 124 EXPECT_TRUE(stub); |
| 125 | 125 |
| 126 // Create second context in same share group but different stream. | 126 // Create second context in same share group but different stream. |
| 127 int32_t kRouteId2 = 2; | 127 int32_t kRouteId2 = 2; |
| 128 int32_t kStreamId2 = 2; | 128 int32_t kStreamId2 = 2; |
| 129 | 129 |
| 130 init_params.share_group_id = kRouteId1; | 130 init_params.share_group_id = kRouteId1; |
| 131 init_params.stream_id = kStreamId2; | 131 init_params.stream_id = kStreamId2; |
| 132 init_params.stream_priority = SchedulingPriority::kNormal; | 132 init_params.stream_priority = GpuStreamPriority::NORMAL; |
| 133 init_params.attribs = gles2::ContextCreationAttribHelper(); | 133 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 134 init_params.active_url = GURL(); | 134 init_params.active_url = GURL(); |
| 135 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 135 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 136 init_params, kRouteId2, GetSharedHandle(), &result, | 136 init_params, kRouteId2, GetSharedHandle(), &result, |
| 137 &capabilities)); | 137 &capabilities)); |
| 138 EXPECT_FALSE(result); | 138 EXPECT_FALSE(result); |
| 139 | 139 |
| 140 stub = channel->LookupCommandBuffer(kRouteId2); | 140 stub = channel->LookupCommandBuffer(kRouteId2); |
| 141 EXPECT_FALSE(stub); | 141 EXPECT_FALSE(stub); |
| 142 } | 142 } |
| 143 | 143 |
| 144 TEST_F(GpuChannelTest, HighPriorityStreamsDisallowed) { | 144 TEST_F(GpuChannelTest, RealTimeStreamsDisallowed) { |
| 145 int32_t kClientId = 1; | 145 int32_t kClientId = 1; |
| 146 bool is_gpu_host = false; | 146 bool is_gpu_host = false; |
| 147 GpuChannel* channel = CreateChannel(kClientId, is_gpu_host); | 147 GpuChannel* channel = CreateChannel(kClientId, is_gpu_host); |
| 148 ASSERT_TRUE(channel); | 148 ASSERT_TRUE(channel); |
| 149 | 149 |
| 150 // Highest priority is disallowed. | 150 // Create first context. |
| 151 int32_t kRouteId = 1; | 151 int32_t kRouteId = 1; |
| 152 int32_t kStreamId = 1; | 152 int32_t kStreamId = 1; |
| 153 GpuStreamPriority kStreamPriority = GpuStreamPriority::REAL_TIME; |
| 153 GPUCreateCommandBufferConfig init_params; | 154 GPUCreateCommandBufferConfig init_params; |
| 154 init_params.surface_handle = kNullSurfaceHandle; | 155 init_params.surface_handle = kNullSurfaceHandle; |
| 155 init_params.share_group_id = MSG_ROUTING_NONE; | 156 init_params.share_group_id = MSG_ROUTING_NONE; |
| 156 init_params.stream_id = kStreamId; | 157 init_params.stream_id = kStreamId; |
| 157 init_params.stream_priority = SchedulingPriority::kHighest; | 158 init_params.stream_priority = kStreamPriority; |
| 158 init_params.attribs = gles2::ContextCreationAttribHelper(); | 159 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 159 init_params.active_url = GURL(); | 160 init_params.active_url = GURL(); |
| 160 bool result = false; | 161 bool result = false; |
| 161 gpu::Capabilities capabilities; | 162 gpu::Capabilities capabilities; |
| 162 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 163 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 163 init_params, kRouteId, GetSharedHandle(), &result, | 164 init_params, kRouteId, GetSharedHandle(), &result, |
| 164 &capabilities)); | 165 &capabilities)); |
| 165 EXPECT_FALSE(result); | 166 EXPECT_FALSE(result); |
| 166 EXPECT_FALSE(channel->LookupCommandBuffer(kRouteId)); | |
| 167 | 167 |
| 168 // High priority is also disallowed. | 168 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
| 169 init_params.stream_priority = SchedulingPriority::kHigh; | 169 EXPECT_FALSE(stub); |
| 170 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | |
| 171 init_params, kRouteId, GetSharedHandle(), &result, | |
| 172 &capabilities)); | |
| 173 EXPECT_FALSE(result); | |
| 174 EXPECT_FALSE(channel->LookupCommandBuffer(kRouteId)); | |
| 175 } | 170 } |
| 176 | 171 |
| 177 TEST_F(GpuChannelTest, HighPriorityStreamsAllowed) { | 172 TEST_F(GpuChannelTest, RealTimeStreamsAllowed) { |
| 178 int32_t kClientId = 1; | 173 int32_t kClientId = 1; |
| 179 bool is_gpu_host = true; | 174 bool is_gpu_host = true; |
| 180 GpuChannel* channel = CreateChannel(kClientId, is_gpu_host); | 175 GpuChannel* channel = CreateChannel(kClientId, is_gpu_host); |
| 181 ASSERT_TRUE(channel); | 176 ASSERT_TRUE(channel); |
| 182 | 177 |
| 183 // Highest priority is allowed. | 178 // Create first context. |
| 184 int32_t kRouteId1 = 1; | 179 int32_t kRouteId = 1; |
| 180 int32_t kStreamId = 1; |
| 181 GpuStreamPriority kStreamPriority = GpuStreamPriority::REAL_TIME; |
| 185 GPUCreateCommandBufferConfig init_params; | 182 GPUCreateCommandBufferConfig init_params; |
| 186 init_params.surface_handle = kNullSurfaceHandle; | 183 init_params.surface_handle = kNullSurfaceHandle; |
| 187 init_params.share_group_id = MSG_ROUTING_NONE; | 184 init_params.share_group_id = MSG_ROUTING_NONE; |
| 188 init_params.stream_id = 1; | 185 init_params.stream_id = kStreamId; |
| 189 init_params.stream_priority = SchedulingPriority::kHighest; | 186 init_params.stream_priority = kStreamPriority; |
| 190 init_params.attribs = gles2::ContextCreationAttribHelper(); | 187 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 191 init_params.active_url = GURL(); | 188 init_params.active_url = GURL(); |
| 192 bool result = false; | 189 bool result = false; |
| 193 gpu::Capabilities capabilities; | 190 gpu::Capabilities capabilities; |
| 194 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 191 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 195 init_params, kRouteId1, GetSharedHandle(), &result, | 192 init_params, kRouteId, GetSharedHandle(), &result, |
| 196 &capabilities)); | 193 &capabilities)); |
| 197 EXPECT_TRUE(result); | 194 EXPECT_TRUE(result); |
| 198 EXPECT_TRUE(channel->LookupCommandBuffer(kRouteId1)); | |
| 199 | 195 |
| 200 // High priority is also allowed. | 196 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
| 201 int32_t kRouteId2 = 2; | 197 EXPECT_TRUE(stub); |
| 202 init_params.stream_id = 2; | |
| 203 init_params.stream_priority = SchedulingPriority::kHigh; | |
| 204 result = false; | |
| 205 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | |
| 206 init_params, kRouteId2, GetSharedHandle(), &result, | |
| 207 &capabilities)); | |
| 208 EXPECT_TRUE(result); | |
| 209 EXPECT_TRUE(channel->LookupCommandBuffer(kRouteId2)); | |
| 210 } | 198 } |
| 211 | 199 |
| 212 TEST_F(GpuChannelTest, CreateFailsIfSharedContextIsLost) { | 200 TEST_F(GpuChannelTest, CreateFailsIfSharedContextIsLost) { |
| 213 int32_t kClientId = 1; | 201 int32_t kClientId = 1; |
| 214 GpuChannel* channel = CreateChannel(kClientId, false); | 202 GpuChannel* channel = CreateChannel(kClientId, false); |
| 215 ASSERT_TRUE(channel); | 203 ASSERT_TRUE(channel); |
| 216 | 204 |
| 217 // Create first context, we will share this one. | 205 // Create first context, we will share this one. |
| 218 int32_t kSharedRouteId = 1; | 206 int32_t kSharedRouteId = 1; |
| 219 { | 207 { |
| 220 SCOPED_TRACE("kSharedRouteId"); | 208 SCOPED_TRACE("kSharedRouteId"); |
| 221 GPUCreateCommandBufferConfig init_params; | 209 GPUCreateCommandBufferConfig init_params; |
| 222 init_params.surface_handle = kNullSurfaceHandle; | 210 init_params.surface_handle = kNullSurfaceHandle; |
| 223 init_params.share_group_id = MSG_ROUTING_NONE; | 211 init_params.share_group_id = MSG_ROUTING_NONE; |
| 224 init_params.stream_id = 0; | 212 init_params.stream_id = 0; |
| 225 init_params.stream_priority = SchedulingPriority::kNormal; | 213 init_params.stream_priority = GpuStreamPriority::NORMAL; |
| 226 init_params.attribs = gles2::ContextCreationAttribHelper(); | 214 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 227 init_params.active_url = GURL(); | 215 init_params.active_url = GURL(); |
| 228 bool result = false; | 216 bool result = false; |
| 229 gpu::Capabilities capabilities; | 217 gpu::Capabilities capabilities; |
| 230 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 218 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 231 init_params, kSharedRouteId, GetSharedHandle(), | 219 init_params, kSharedRouteId, GetSharedHandle(), |
| 232 &result, &capabilities)); | 220 &result, &capabilities)); |
| 233 EXPECT_TRUE(result); | 221 EXPECT_TRUE(result); |
| 234 } | 222 } |
| 235 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); | 223 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); |
| 236 | 224 |
| 237 // This context shares with the first one, this should be possible. | 225 // This context shares with the first one, this should be possible. |
| 238 int32_t kFriendlyRouteId = 2; | 226 int32_t kFriendlyRouteId = 2; |
| 239 { | 227 { |
| 240 SCOPED_TRACE("kFriendlyRouteId"); | 228 SCOPED_TRACE("kFriendlyRouteId"); |
| 241 GPUCreateCommandBufferConfig init_params; | 229 GPUCreateCommandBufferConfig init_params; |
| 242 init_params.surface_handle = kNullSurfaceHandle; | 230 init_params.surface_handle = kNullSurfaceHandle; |
| 243 init_params.share_group_id = kSharedRouteId; | 231 init_params.share_group_id = kSharedRouteId; |
| 244 init_params.stream_id = 0; | 232 init_params.stream_id = 0; |
| 245 init_params.stream_priority = SchedulingPriority::kNormal; | 233 init_params.stream_priority = GpuStreamPriority::NORMAL; |
| 246 init_params.attribs = gles2::ContextCreationAttribHelper(); | 234 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 247 init_params.active_url = GURL(); | 235 init_params.active_url = GURL(); |
| 248 bool result = false; | 236 bool result = false; |
| 249 gpu::Capabilities capabilities; | 237 gpu::Capabilities capabilities; |
| 250 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 238 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 251 init_params, kFriendlyRouteId, GetSharedHandle(), | 239 init_params, kFriendlyRouteId, GetSharedHandle(), |
| 252 &result, &capabilities)); | 240 &result, &capabilities)); |
| 253 EXPECT_TRUE(result); | 241 EXPECT_TRUE(result); |
| 254 } | 242 } |
| 255 EXPECT_TRUE(channel->LookupCommandBuffer(kFriendlyRouteId)); | 243 EXPECT_TRUE(channel->LookupCommandBuffer(kFriendlyRouteId)); |
| 256 | 244 |
| 257 // The shared context is lost. | 245 // The shared context is lost. |
| 258 channel->LookupCommandBuffer(kSharedRouteId)->MarkContextLost(); | 246 channel->LookupCommandBuffer(kSharedRouteId)->MarkContextLost(); |
| 259 | 247 |
| 260 // Meanwhile another context is being made pointing to the shared one. This | 248 // Meanwhile another context is being made pointing to the shared one. This |
| 261 // should fail. | 249 // should fail. |
| 262 int32_t kAnotherRouteId = 3; | 250 int32_t kAnotherRouteId = 3; |
| 263 { | 251 { |
| 264 SCOPED_TRACE("kAnotherRouteId"); | 252 SCOPED_TRACE("kAnotherRouteId"); |
| 265 GPUCreateCommandBufferConfig init_params; | 253 GPUCreateCommandBufferConfig init_params; |
| 266 init_params.surface_handle = kNullSurfaceHandle; | 254 init_params.surface_handle = kNullSurfaceHandle; |
| 267 init_params.share_group_id = kSharedRouteId; | 255 init_params.share_group_id = kSharedRouteId; |
| 268 init_params.stream_id = 0; | 256 init_params.stream_id = 0; |
| 269 init_params.stream_priority = SchedulingPriority::kNormal; | 257 init_params.stream_priority = GpuStreamPriority::NORMAL; |
| 270 init_params.attribs = gles2::ContextCreationAttribHelper(); | 258 init_params.attribs = gles2::ContextCreationAttribHelper(); |
| 271 init_params.active_url = GURL(); | 259 init_params.active_url = GURL(); |
| 272 bool result = false; | 260 bool result = false; |
| 273 gpu::Capabilities capabilities; | 261 gpu::Capabilities capabilities; |
| 274 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 262 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 275 init_params, kAnotherRouteId, GetSharedHandle(), | 263 init_params, kAnotherRouteId, GetSharedHandle(), |
| 276 &result, &capabilities)); | 264 &result, &capabilities)); |
| 277 EXPECT_FALSE(result); | 265 EXPECT_FALSE(result); |
| 278 } | 266 } |
| 279 EXPECT_FALSE(channel->LookupCommandBuffer(kAnotherRouteId)); | 267 EXPECT_FALSE(channel->LookupCommandBuffer(kAnotherRouteId)); |
| 280 | 268 |
| 281 // The lost context is still around though (to verify the failure happened due | 269 // The lost context is still around though (to verify the failure happened due |
| 282 // to the shared context being lost, not due to it being deleted). | 270 // to the shared context being lost, not due to it being deleted). |
| 283 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); | 271 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); |
| 284 | 272 |
| 285 // Destroy the command buffers we initialized before destoying GL. | 273 // Destroy the command buffers we initialized before destoying GL. |
| 286 HandleMessage(channel, | 274 HandleMessage(channel, |
| 287 new GpuChannelMsg_DestroyCommandBuffer(kFriendlyRouteId)); | 275 new GpuChannelMsg_DestroyCommandBuffer(kFriendlyRouteId)); |
| 288 HandleMessage(channel, | 276 HandleMessage(channel, |
| 289 new GpuChannelMsg_DestroyCommandBuffer(kSharedRouteId)); | 277 new GpuChannelMsg_DestroyCommandBuffer(kSharedRouteId)); |
| 290 } | 278 } |
| 291 | 279 |
| 292 } // namespace gpu | 280 } // namespace gpu |
| OLD | NEW |