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

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

Issue 538273002: Avoid memcmp on potentially unpacked structs in MailboxManager::TargetNameLess (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/mailbox_manager.h" 5 #include "gpu/command_buffer/service/mailbox_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "crypto/random.h" 9 #include "crypto/random.h"
10 #include "gpu/command_buffer/service/mailbox_synchronizer.h" 10 #include "gpu/command_buffer/service/mailbox_synchronizer.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 sync_->PullTextureUpdates(this); 94 sync_->PullTextureUpdates(this);
95 } 95 }
96 96
97 MailboxManager::TargetName::TargetName(unsigned target, const Mailbox& mailbox) 97 MailboxManager::TargetName::TargetName(unsigned target, const Mailbox& mailbox)
98 : target(target), 98 : target(target),
99 mailbox(mailbox) { 99 mailbox(mailbox) {
100 } 100 }
101 101
102 bool MailboxManager::TargetNameLess(const MailboxManager::TargetName& lhs, 102 bool MailboxManager::TargetNameLess(const MailboxManager::TargetName& lhs,
103 const MailboxManager::TargetName& rhs) { 103 const MailboxManager::TargetName& rhs) {
104 return memcmp(&lhs, &rhs, sizeof(lhs)) < 0; 104 if (lhs.target != rhs.target)
105 return lhs.target < rhs.target;
106 return lhs.mailbox < rhs.mailbox;
105 } 107 }
106 108
107 } // namespace gles2 109 } // namespace gles2
108 } // namespace gpu 110 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698