Bug 1337189 (part 10) - Move entrySize_ out of Sampler. r=mstange.

--HG--
extra : rebase_source : 599be59343311c421b00c6bd7e0674175dc57445
This commit is contained in:
Nicholas Nethercote 2017-02-07 15:22:52 +11:00
Родитель 5be61e6eca
Коммит aaa8c223f7
3 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -204,7 +204,6 @@ Sampler::Sampler(double aInterval, int aEntrySize,
: interval_(aInterval)
, paused_(false)
, active_(false)
, entrySize_(aEntrySize)
, mBuffer(new ProfileBuffer(aEntrySize))
{
MOZ_COUNT_CTOR(Sampler);
@ -1262,7 +1261,7 @@ Sampler::GetBufferInfo(uint32_t *aCurrentPosition, uint32_t *aTotalSize,
uint32_t *aGeneration)
{
*aCurrentPosition = mBuffer->mWritePos;
*aTotalSize = mBuffer->mEntrySize;
*aTotalSize = gEntrySize;
*aGeneration = mBuffer->mGeneration;
}

Просмотреть файл

@ -87,6 +87,9 @@ static mozilla::StaticMutex gThreadNameFiltersMutex;
// All accesses to gFeatures are on the main thread, so no locking is needed.
static Vector<std::string> gFeatures;
// All accesses to gEntrySize are on the main thread, so no locking is needed.
static int gEntrySize = 0;
// We need to track whether we've been initialized otherwise
// we end up using tlsStack without initializing it.
// Because tlsStack is totally opaque to us we can't reuse
@ -677,7 +680,7 @@ profiler_get_start_params(int* aEntrySize,
return;
}
*aEntrySize = gSampler->EntrySize();
*aEntrySize = gEntrySize;
*aInterval = gSampler->interval();
{
@ -852,9 +855,9 @@ profiler_start(int aProfileEntries, double aInterval,
gFeatures[i] = aFeatures[i];
}
gEntrySize = aProfileEntries ? aProfileEntries : PROFILE_DEFAULT_ENTRY;
gSampler =
new Sampler(aInterval ? aInterval : PROFILE_DEFAULT_INTERVAL,
aProfileEntries ? aProfileEntries : PROFILE_DEFAULT_ENTRY,
new Sampler(aInterval ? aInterval : PROFILE_DEFAULT_INTERVAL, gEntrySize,
aFeatures, aFeatureCount, aFilterCount);
gGatherer = new mozilla::ProfileGatherer(gSampler);
@ -954,6 +957,7 @@ profiler_stop()
gSampler->Stop();
delete gSampler;
gSampler = nullptr;
gEntrySize = 0;
// Cancel any in-flight async profile gatherering requests.
gGatherer->Cancel();

Просмотреть файл

@ -272,8 +272,6 @@ public:
bool IsPaused() const { return paused_; }
void SetPaused(bool value) { NoBarrier_Store(&paused_, value); }
int EntrySize() { return entrySize_; }
// We can't new/delete the type safely without defining it
// (-Wdelete-incomplete). Use these to hide the details from
// clients.
@ -344,7 +342,6 @@ private:
const double interval_;
Atomic32 paused_;
Atomic32 active_;
const int entrySize_;
// Refactor me!
#if defined(SPS_OS_linux) || defined(SPS_OS_android)