1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tools/profiler/ProfilerIOInterposeObserver.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "GeckoProfiler.h" 1.9 +#include "ProfilerIOInterposeObserver.h" 1.10 +#include "ProfilerMarkers.h" 1.11 + 1.12 +using namespace mozilla; 1.13 + 1.14 +void ProfilerIOInterposeObserver::Observe(Observation& aObservation) 1.15 +{ 1.16 + if (!IsMainThread()) { 1.17 + return; 1.18 + } 1.19 + 1.20 + ProfilerBacktrace* stack = profiler_get_backtrace(); 1.21 + 1.22 + nsCString filename; 1.23 + if (aObservation.Filename()) { 1.24 + filename = NS_ConvertUTF16toUTF8(aObservation.Filename()); 1.25 + } 1.26 + 1.27 + IOMarkerPayload* markerPayload = new IOMarkerPayload(aObservation.Reference(), 1.28 + filename.get(), 1.29 + aObservation.Start(), 1.30 + aObservation.End(), 1.31 + stack); 1.32 + PROFILER_MARKER_PAYLOAD(aObservation.ObservedOperationString(), markerPayload); 1.33 +}