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

Side by Side Diff: ppapi/proxy/interface_list.cc

Issue 824153003: replace COMPILE_ASSERT with static_assert in ppapi/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 11 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 | ppapi/proxy/ppapi_message_utils.h » ('j') | 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 "ppapi/proxy/interface_list.h" 5 #include "ppapi/proxy/interface_list.h"
6 6
7 #include "base/hash.h" 7 #include "base/hash.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "ppapi/c/dev/ppb_audio_input_dev.h" 10 #include "ppapi/c/dev/ppb_audio_input_dev.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 326 }
327 327
328 // static 328 // static
329 void InterfaceList::SetProcessGlobalPermissions( 329 void InterfaceList::SetProcessGlobalPermissions(
330 const PpapiPermissions& permissions) { 330 const PpapiPermissions& permissions) {
331 g_process_global_permissions.Get() = permissions; 331 g_process_global_permissions.Get() = permissions;
332 } 332 }
333 333
334 InterfaceProxy::Factory InterfaceList::GetFactoryForID(ApiID id) const { 334 InterfaceProxy::Factory InterfaceList::GetFactoryForID(ApiID id) const {
335 int index = static_cast<int>(id); 335 int index = static_cast<int>(id);
336 COMPILE_ASSERT(API_ID_NONE == 0, none_must_be_zero); 336 static_assert(API_ID_NONE == 0, "none must be zero");
337 if (id <= 0 || id >= API_ID_COUNT) 337 if (id <= 0 || id >= API_ID_COUNT)
338 return NULL; 338 return NULL;
339 return id_to_factory_[index]; 339 return id_to_factory_[index];
340 } 340 }
341 341
342 const void* InterfaceList::GetInterfaceForPPB(const std::string& name) { 342 const void* InterfaceList::GetInterfaceForPPB(const std::string& name) {
343 // CAUTION: This function is called without the ProxyLock to avoid excessive 343 // CAUTION: This function is called without the ProxyLock to avoid excessive
344 // excessive locking from C++ wrappers. (See also GetBrowserInterface.) 344 // excessive locking from C++ wrappers. (See also GetBrowserInterface.)
345 NameToInterfaceInfoMap::iterator found = 345 NameToInterfaceInfoMap::iterator found =
346 name_to_browser_info_.find(name); 346 name_to_browser_info_.find(name);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 412
413 int InterfaceList::HashInterfaceName(const std::string& name) { 413 int InterfaceList::HashInterfaceName(const std::string& name) {
414 uint32 data = base::Hash(name.c_str(), name.size()); 414 uint32 data = base::Hash(name.c_str(), name.size());
415 // Strip off the signed bit because UMA doesn't support negative values, 415 // Strip off the signed bit because UMA doesn't support negative values,
416 // but takes a signed int as input. 416 // but takes a signed int as input.
417 return static_cast<int>(data & 0x7fffffff); 417 return static_cast<int>(data & 0x7fffffff);
418 } 418 }
419 419
420 } // namespace proxy 420 } // namespace proxy
421 } // namespace ppapi 421 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/ppapi_message_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698