| 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/mailbox_manager.h" | 5 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "crypto/hmac.h" | 10 #include "crypto/hmac.h" |
| 11 #include "gpu/command_buffer/common/mailbox.h" | |
| 12 #include "gpu/command_buffer/service/gl_utils.h" | 11 #include "gpu/command_buffer/service/gl_utils.h" |
| 13 #include "gpu/command_buffer/service/texture_definition.h" | 12 #include "gpu/command_buffer/service/texture_definition.h" |
| 14 | 13 |
| 15 namespace gpu { | 14 namespace gpu { |
| 16 namespace gles2 { | 15 namespace gles2 { |
| 17 | 16 |
| 18 MailboxName::MailboxName() { | 17 MailboxName::MailboxName() { |
| 19 std::fill(key, key + sizeof(key), 0); | 18 std::fill(key, key + sizeof(key), 0); |
| 20 std::fill(signature, signature + sizeof(signature), 0); | 19 std::fill(signature, signature + sizeof(signature), 0); |
| 21 } | 20 } |
| 22 | 21 |
| 23 MailboxName::MailboxName(const ::gpu::Mailbox& mailbox) { | |
| 24 std::copy(mailbox.name, mailbox.name + sizeof(mailbox.name), key); | |
| 25 } | |
| 26 | |
| 27 MailboxManager::MailboxManager() | 22 MailboxManager::MailboxManager() |
| 28 : hmac_(crypto::HMAC::SHA256), | 23 : hmac_(crypto::HMAC::SHA256), |
| 29 textures_(std::ptr_fun(&MailboxManager::TargetNameLess)) { | 24 textures_(std::ptr_fun(&MailboxManager::TargetNameLess)) { |
| 30 base::RandBytes(private_key_, sizeof(private_key_)); | 25 base::RandBytes(private_key_, sizeof(private_key_)); |
| 31 bool success = hmac_.Init( | 26 bool success = hmac_.Init( |
| 32 base::StringPiece(private_key_, sizeof(private_key_))); | 27 base::StringPiece(private_key_, sizeof(private_key_))); |
| 33 DCHECK(success); | 28 DCHECK(success); |
| 34 DCHECK(!IsMailboxNameValid(MailboxName())); | 29 DCHECK(!IsMailboxNameValid(MailboxName())); |
| 35 } | 30 } |
| 36 | 31 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 TextureManager* owner) | 123 TextureManager* owner) |
| 129 : definition(definition), | 124 : definition(definition), |
| 130 owner(owner) { | 125 owner(owner) { |
| 131 } | 126 } |
| 132 | 127 |
| 133 MailboxManager::OwnedTextureDefinition::~OwnedTextureDefinition() { | 128 MailboxManager::OwnedTextureDefinition::~OwnedTextureDefinition() { |
| 134 } | 129 } |
| 135 | 130 |
| 136 } // namespace gles2 | 131 } // namespace gles2 |
| 137 } // namespace gpu | 132 } // namespace gpu |
| OLD | NEW |