tools/profiler/SyncProfile.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef __SYNCPROFILE_H
michael@0 8 #define __SYNCPROFILE_H
michael@0 9
michael@0 10 #include "ProfileEntry.h"
michael@0 11
michael@0 12 struct LinkedUWTBuffer;
michael@0 13
michael@0 14 class SyncProfile : public ThreadProfile
michael@0 15 {
michael@0 16 public:
michael@0 17 SyncProfile(const char* aName, int aEntrySize, PseudoStack *aStack,
michael@0 18 Thread::tid_t aThreadId, bool aIsMainThread);
michael@0 19 ~SyncProfile();
michael@0 20
michael@0 21 bool SetUWTBuffer(LinkedUWTBuffer* aBuff);
michael@0 22 LinkedUWTBuffer* GetUWTBuffer() { return mUtb; }
michael@0 23
michael@0 24 virtual void EndUnwind();
michael@0 25 virtual SyncProfile* AsSyncProfile() { return this; }
michael@0 26
michael@0 27 private:
michael@0 28 friend class ProfilerBacktrace;
michael@0 29
michael@0 30 enum OwnerState
michael@0 31 {
michael@0 32 REFERENCED, // ProfilerBacktrace has a pointer to this but doesn't own
michael@0 33 OWNED, // ProfilerBacktrace is responsible for destroying this
michael@0 34 OWNER_DESTROYING, // ProfilerBacktrace owns this and is destroying
michael@0 35 ORPHANED // No owner, we must destroy ourselves
michael@0 36 };
michael@0 37
michael@0 38 bool ShouldDestroy();
michael@0 39
michael@0 40 OwnerState mOwnerState;
michael@0 41 LinkedUWTBuffer* mUtb;
michael@0 42 };
michael@0 43
michael@0 44 #endif // __SYNCPROFILE_H
michael@0 45

mercurial