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 "ppapi/proxy/interface_list.h" | 5 #include "ppapi/proxy/interface_list.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 DCHECK(!id_to_factory_[index] || id_to_factory_[index] == factory); | 391 DCHECK(!id_to_factory_[index] || id_to_factory_[index] == factory); |
392 | 392 |
393 id_to_factory_[index] = factory; | 393 id_to_factory_[index] = factory; |
394 } | 394 } |
395 | 395 |
396 void InterfaceList::AddPPB(const char* name, | 396 void InterfaceList::AddPPB(const char* name, |
397 const void* iface, | 397 const void* iface, |
398 Permission perm) { | 398 Permission perm) { |
399 DCHECK(name_to_browser_info_.find(name) == name_to_browser_info_.end()); | 399 DCHECK(name_to_browser_info_.find(name) == name_to_browser_info_.end()); |
400 name_to_browser_info_.add( | 400 name_to_browser_info_.add( |
401 name, scoped_ptr<InterfaceInfo>(new InterfaceInfo(iface, perm))); | 401 name, std::unique_ptr<InterfaceInfo>(new InterfaceInfo(iface, perm))); |
402 } | 402 } |
403 | 403 |
404 void InterfaceList::AddPPP(const char* name, | 404 void InterfaceList::AddPPP(const char* name, |
405 const void* iface) { | 405 const void* iface) { |
406 DCHECK(name_to_plugin_info_.find(name) == name_to_plugin_info_.end()); | 406 DCHECK(name_to_plugin_info_.find(name) == name_to_plugin_info_.end()); |
407 name_to_plugin_info_.add( | 407 name_to_plugin_info_.add(name, |
408 name, | 408 std::unique_ptr<InterfaceInfo>( |
409 scoped_ptr<InterfaceInfo>(new InterfaceInfo(iface, PERMISSION_NONE))); | 409 new InterfaceInfo(iface, PERMISSION_NONE))); |
410 } | 410 } |
411 | 411 |
412 int InterfaceList::HashInterfaceName(const std::string& name) { | 412 int InterfaceList::HashInterfaceName(const std::string& name) { |
413 uint32_t data = base::Hash(name.c_str(), name.size()); | 413 uint32_t data = base::Hash(name.c_str(), name.size()); |
414 // Strip off the signed bit because UMA doesn't support negative values, | 414 // Strip off the signed bit because UMA doesn't support negative values, |
415 // but takes a signed int as input. | 415 // but takes a signed int as input. |
416 return static_cast<int>(data & 0x7fffffff); | 416 return static_cast<int>(data & 0x7fffffff); |
417 } | 417 } |
418 | 418 |
419 } // namespace proxy | 419 } // namespace proxy |
420 } // namespace ppapi | 420 } // namespace ppapi |
OLD | NEW |