author Benoit Girard <>
Tue, 30 Jun 2015 15:03:45 -0400
changeset 251392 94714c206f188a4587bdcb4d00ec72019c0925ca
parent 180485 tools/profiler/SaveProfileTask.cpp@6c1c7e45c90289a0875b74f82f39e7ecf6a65af3
permissions -rw-r--r--
Bug 1178892 - Split the profiler into Core & Gecko files and break apart monolithic headers. r=mstange

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#include "SaveProfileTask.h"
#include "GeckoProfiler.h"

SaveProfileTask::Run() {
  // Get file path
#if defined(SPS_PLAT_arm_android) && !defined(MOZ_WIDGET_GONK)
  nsCString tmpPath;
  tmpPath.AppendPrintf("/sdcard/profile_%i_%i.txt", XRE_GetProcessType(), getpid());
  nsCOMPtr<nsIFile> tmpFile;
  nsAutoCString tmpPath;
  if (NS_FAILED(NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpFile)))) {
    LOG("Failed to find temporary directory.");
    return NS_ERROR_FAILURE;
  tmpPath.AppendPrintf("profile_%i_%i.txt", XRE_GetProcessType(), getpid());

  nsresult rv = tmpFile->AppendNative(tmpPath);
  if (NS_FAILED(rv))
    return rv;

  rv = tmpFile->GetNativePath(tmpPath);
  if (NS_FAILED(rv))
    return rv;


  return NS_OK;

NS_IMPL_ISUPPORTS(ProfileSaveEvent, nsIProfileSaveEvent)

ProfileSaveEvent::AddSubProfile(const char* aProfile) {
  mFunc(aProfile, mClosure);
  return NS_OK;