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