-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
483 changed files
with
119,121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2008-2014 Marshall A. Greenblatt. Portions Copyright (c) | ||
// 2006-2009 Google Inc. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the name Chromium Embedded | ||
// Framework nor the names of its contributors may be used to endorse | ||
// or promote products derived from this software without specific prior | ||
// written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
126 changes: 126 additions & 0 deletions
126
Plugins/BLUI/ThirdParty/cef/Linux/include/base/cef_atomic_ref_count.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 | ||
// Google Inc. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the name Chromium Embedded | ||
// Framework nor the names of its contributors may be used to endorse | ||
// or promote products derived from this software without specific prior | ||
// written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
// This is a low level implementation of atomic semantics for reference | ||
// counting. Please use cef_ref_counted.h directly instead. | ||
// | ||
// The Chromium implementation includes annotations to avoid some false | ||
// positives when using data race detection tools. Annotations are not | ||
// currently supported by the CEF implementation. | ||
|
||
#ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ | ||
#define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ | ||
#pragma once | ||
|
||
#if defined(BASE_ATOMIC_REF_COUNT_H_) | ||
// Do nothing if the Chromium header has already been included. | ||
// This can happen in cases where Chromium code is used directly by the | ||
// client application. When using Chromium code directly always include | ||
// the Chromium header first to avoid type conflicts. | ||
#elif defined(BUILDING_CEF_SHARED) | ||
// When building CEF include the Chromium header directly. | ||
#include "base/atomic_ref_count.h" | ||
#else // !BUILDING_CEF_SHARED | ||
// The following is substantially similar to the Chromium implementation. | ||
// If the Chromium implementation diverges the below implementation should be | ||
// updated to match. | ||
|
||
#include "include/base/cef_atomicops.h" | ||
|
||
// Annotations are not currently supported. | ||
#define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */ | ||
#define ANNOTATE_HAPPENS_AFTER(obj) /* empty */ | ||
|
||
namespace base { | ||
|
||
typedef subtle::Atomic32 AtomicRefCount; | ||
|
||
// Increment a reference count by "increment", which must exceed 0. | ||
inline void AtomicRefCountIncN(volatile AtomicRefCount *ptr, | ||
AtomicRefCount increment) { | ||
subtle::NoBarrier_AtomicIncrement(ptr, increment); | ||
} | ||
|
||
// Decrement a reference count by "decrement", which must exceed 0, | ||
// and return whether the result is non-zero. | ||
// Insert barriers to ensure that state written before the reference count | ||
// became zero will be visible to a thread that has just made the count zero. | ||
inline bool AtomicRefCountDecN(volatile AtomicRefCount *ptr, | ||
AtomicRefCount decrement) { | ||
ANNOTATE_HAPPENS_BEFORE(ptr); | ||
bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0); | ||
if (!res) { | ||
ANNOTATE_HAPPENS_AFTER(ptr); | ||
} | ||
return res; | ||
} | ||
|
||
// Increment a reference count by 1. | ||
inline void AtomicRefCountInc(volatile AtomicRefCount *ptr) { | ||
base::AtomicRefCountIncN(ptr, 1); | ||
} | ||
|
||
// Decrement a reference count by 1 and return whether the result is non-zero. | ||
// Insert barriers to ensure that state written before the reference count | ||
// became zero will be visible to a thread that has just made the count zero. | ||
inline bool AtomicRefCountDec(volatile AtomicRefCount *ptr) { | ||
return base::AtomicRefCountDecN(ptr, 1); | ||
} | ||
|
||
// Return whether the reference count is one. If the reference count is used | ||
// in the conventional way, a refrerence count of 1 implies that the current | ||
// thread owns the reference and no other thread shares it. This call performs | ||
// the test for a reference count of one, and performs the memory barrier | ||
// needed for the owning thread to act on the object, knowing that it has | ||
// exclusive access to the object. | ||
inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) { | ||
bool res = (subtle::Acquire_Load(ptr) == 1); | ||
if (res) { | ||
ANNOTATE_HAPPENS_AFTER(ptr); | ||
} | ||
return res; | ||
} | ||
|
||
// Return whether the reference count is zero. With conventional object | ||
// referencing counting, the object will be destroyed, so the reference count | ||
// should never be zero. Hence this is generally used for a debug check. | ||
inline bool AtomicRefCountIsZero(volatile AtomicRefCount *ptr) { | ||
bool res = (subtle::Acquire_Load(ptr) == 0); | ||
if (res) { | ||
ANNOTATE_HAPPENS_AFTER(ptr); | ||
} | ||
return res; | ||
} | ||
|
||
} // namespace base | ||
|
||
#endif // !BUILDING_CEF_SHARED | ||
|
||
#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ |
198 changes: 198 additions & 0 deletions
198
Plugins/BLUI/ThirdParty/cef/Linux/include/base/cef_atomicops.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 | ||
// Google Inc. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the name Chromium Embedded | ||
// Framework nor the names of its contributors may be used to endorse | ||
// or promote products derived from this software without specific prior | ||
// written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
// For atomic operations on reference counts, see cef_atomic_ref_count.h. | ||
|
||
// The routines exported by this module are subtle. If you use them, even if | ||
// you get the code right, it will depend on careful reasoning about atomicity | ||
// and memory ordering; it will be less readable, and harder to maintain. If | ||
// you plan to use these routines, you should have a good reason, such as solid | ||
// evidence that performance would otherwise suffer, or there being no | ||
// alternative. You should assume only properties explicitly guaranteed by the | ||
// specifications in this file. You are almost certainly _not_ writing code | ||
// just for the x86; if you assume x86 semantics, x86 hardware bugs and | ||
// implementations on other archtectures will cause your code to break. If you | ||
// do not know what you are doing, avoid these routines, and use a Mutex. | ||
// | ||
// It is incorrect to make direct assignments to/from an atomic variable. | ||
// You should use one of the Load or Store routines. The NoBarrier | ||
// versions are provided when no barriers are needed: | ||
// NoBarrier_Store() | ||
// NoBarrier_Load() | ||
// Although there are currently no compiler enforcement, you are encouraged | ||
// to use these. | ||
// | ||
|
||
#ifndef CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ | ||
#define CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ | ||
#pragma once | ||
|
||
#if defined(BASE_ATOMICOPS_H_) | ||
// Do nothing if the Chromium header has already been included. | ||
// This can happen in cases where Chromium code is used directly by the | ||
// client application. When using Chromium code directly always include | ||
// the Chromium header first to avoid type conflicts. | ||
#elif defined(BUILDING_CEF_SHARED) | ||
// When building CEF include the Chromium header directly. | ||
#include "base/atomicops.h" | ||
#else // !BUILDING_CEF_SHARED | ||
// The following is substantially similar to the Chromium implementation. | ||
// If the Chromium implementation diverges the below implementation should be | ||
// updated to match. | ||
|
||
#include <stdint.h> | ||
|
||
#include "include/base/cef_build.h" | ||
|
||
#if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) | ||
// windows.h #defines this (only on x64). This causes problems because the | ||
// public API also uses MemoryBarrier at the public name for this fence. So, on | ||
// X64, undef it, and call its documented | ||
// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) | ||
// implementation directly. | ||
#undef MemoryBarrier | ||
#endif | ||
|
||
namespace base { | ||
namespace subtle { | ||
|
||
typedef int32_t Atomic32; | ||
#ifdef ARCH_CPU_64_BITS | ||
// We need to be able to go between Atomic64 and AtomicWord implicitly. This | ||
// means Atomic64 and AtomicWord should be the same type on 64-bit. | ||
#if defined(__ILP32__) || defined(OS_NACL) | ||
// NaCl's intptr_t is not actually 64-bits on 64-bit! | ||
// http://code.google.com/p/nativeclient/issues/detail?id=1162 | ||
typedef int64_t Atomic64; | ||
#else | ||
typedef intptr_t Atomic64; | ||
#endif | ||
#endif | ||
|
||
// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or | ||
// Atomic64 routines below, depending on your architecture. | ||
typedef intptr_t AtomicWord; | ||
|
||
// Atomically execute: | ||
// result = *ptr; | ||
// if (*ptr == old_value) | ||
// *ptr = new_value; | ||
// return result; | ||
// | ||
// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value". | ||
// Always return the old value of "*ptr" | ||
// | ||
// This routine implies no memory barriers. | ||
Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, | ||
Atomic32 old_value, | ||
Atomic32 new_value); | ||
|
||
// Atomically store new_value into *ptr, returning the previous value held in | ||
// *ptr. This routine implies no memory barriers. | ||
Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value); | ||
|
||
// Atomically increment *ptr by "increment". Returns the new value of | ||
// *ptr with the increment applied. This routine implies no memory barriers. | ||
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment); | ||
|
||
Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, | ||
Atomic32 increment); | ||
|
||
// These following lower-level operations are typically useful only to people | ||
// implementing higher-level synchronization operations like spinlocks, | ||
// mutexes, and condition-variables. They combine CompareAndSwap(), a load, or | ||
// a store with appropriate memory-ordering instructions. "Acquire" operations | ||
// ensure that no later memory access can be reordered ahead of the operation. | ||
// "Release" operations ensure that no previous memory access can be reordered | ||
// after the operation. "Barrier" operations have both "Acquire" and "Release" | ||
// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory | ||
// access. | ||
Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, | ||
Atomic32 old_value, | ||
Atomic32 new_value); | ||
Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, | ||
Atomic32 old_value, | ||
Atomic32 new_value); | ||
|
||
void MemoryBarrier(); | ||
void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value); | ||
void Acquire_Store(volatile Atomic32* ptr, Atomic32 value); | ||
void Release_Store(volatile Atomic32* ptr, Atomic32 value); | ||
|
||
Atomic32 NoBarrier_Load(volatile const Atomic32* ptr); | ||
Atomic32 Acquire_Load(volatile const Atomic32* ptr); | ||
Atomic32 Release_Load(volatile const Atomic32* ptr); | ||
|
||
// 64-bit atomic operations (only available on 64-bit processors). | ||
#ifdef ARCH_CPU_64_BITS | ||
Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, | ||
Atomic64 old_value, | ||
Atomic64 new_value); | ||
Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value); | ||
Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment); | ||
Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment); | ||
|
||
Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, | ||
Atomic64 old_value, | ||
Atomic64 new_value); | ||
Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, | ||
Atomic64 old_value, | ||
Atomic64 new_value); | ||
void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value); | ||
void Acquire_Store(volatile Atomic64* ptr, Atomic64 value); | ||
void Release_Store(volatile Atomic64* ptr, Atomic64 value); | ||
Atomic64 NoBarrier_Load(volatile const Atomic64* ptr); | ||
Atomic64 Acquire_Load(volatile const Atomic64* ptr); | ||
Atomic64 Release_Load(volatile const Atomic64* ptr); | ||
#endif // ARCH_CPU_64_BITS | ||
|
||
} // namespace subtle | ||
} // namespace base | ||
|
||
// Include our platform specific implementation. | ||
#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY) | ||
#include "include/base/internal/cef_atomicops_x86_msvc.h" | ||
#elif defined(OS_MACOSX) | ||
#include "include/base/internal/cef_atomicops_mac.h" | ||
#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY) | ||
#include "include/base/internal/cef_atomicops_x86_gcc.h" | ||
#else | ||
#error "Atomic operations are not supported on your platform" | ||
#endif | ||
|
||
// On some platforms we need additional declarations to make | ||
// AtomicWord compatible with our other Atomic* types. | ||
#if defined(OS_MACOSX) || defined(OS_OPENBSD) | ||
#include "include/base/internal/cef_atomicops_atomicword_compat.h" | ||
#endif | ||
|
||
#endif // !BUILDING_CEF_SHARED | ||
|
||
#endif // CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ |
Oops, something went wrong.