gfx/skia/trunk/src/utils/SkThreadUtils_pthread_mach.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /*
     2  * Copyright 2012 Google Inc.
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     8 #include "SkThreadUtils.h"
     9 #include "SkThreadUtils_pthread.h"
    11 #include <mach/mach.h>
    12 #include <mach/thread_policy.h>
    13 #include <pthread.h>
    15 bool SkThread::setProcessorAffinity(unsigned int processor) {
    16     SkThread_PThreadData* pthreadData = static_cast<SkThread_PThreadData*>(fData);
    17     if (!pthreadData->fValidPThread) {
    18         return false;
    19     }
    21     mach_port_t tid = pthread_mach_thread_np(pthreadData->fPThread);
    23     thread_affinity_policy_data_t policy;
    24     policy.affinity_tag = processor;
    26     return 0 == thread_policy_set(tid,
    27                                   THREAD_AFFINITY_POLICY,
    28                                   (thread_policy_t) &policy,
    29                                   THREAD_AFFINITY_POLICY_COUNT);
    30 }

mercurial