OLD | NEW |
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/common_decoder.h" | 5 #include "gpu/command_buffer/service/common_decoder.h" |
6 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 6 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
7 | 7 |
8 namespace gpu { | 8 namespace gpu { |
9 | 9 |
10 CommonDecoder::Bucket::Bucket() : size_(0) {} | 10 CommonDecoder::Bucket::Bucket() : size_(0) {} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return true; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 CommonDecoder::CommonDecoder() : engine_(NULL) {} | 59 CommonDecoder::CommonDecoder() : engine_(NULL) {} |
60 | 60 |
61 CommonDecoder::~CommonDecoder() {} | 61 CommonDecoder::~CommonDecoder() {} |
62 | 62 |
63 void* CommonDecoder::GetAddressAndCheckSize(unsigned int shm_id, | 63 void* CommonDecoder::GetAddressAndCheckSize(unsigned int shm_id, |
64 unsigned int offset, | 64 unsigned int offset, |
65 unsigned int size) { | 65 unsigned int size) { |
| 66 CHECK(engine_); |
66 Buffer buffer = engine_->GetSharedMemoryBuffer(shm_id); | 67 Buffer buffer = engine_->GetSharedMemoryBuffer(shm_id); |
67 if (!buffer.ptr) | 68 if (!buffer.ptr) |
68 return NULL; | 69 return NULL; |
69 unsigned int end = offset + size; | 70 unsigned int end = offset + size; |
70 if (end > buffer.size || end < offset) { | 71 if (end > buffer.size || end < offset) { |
71 return NULL; | 72 return NULL; |
72 } | 73 } |
73 return static_cast<int8*>(buffer.ptr) + offset; | 74 return static_cast<int8*>(buffer.ptr) + offset; |
74 } | 75 } |
75 | 76 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 294 } |
294 const void* src = bucket->GetData(offset, size); | 295 const void* src = bucket->GetData(offset, size); |
295 if (!src) { | 296 if (!src) { |
296 return error::kInvalidArguments; | 297 return error::kInvalidArguments; |
297 } | 298 } |
298 memcpy(data, src, size); | 299 memcpy(data, src, size); |
299 return error::kNoError; | 300 return error::kNoError; |
300 } | 301 } |
301 | 302 |
302 } // namespace gpu | 303 } // namespace gpu |
OLD | NEW |