michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef PROFILER_SAVETASK_H_ michael@0: #define PROFILER_SAVETASK_H_ michael@0: michael@0: #include "platform.h" michael@0: #include "nsThreadUtils.h" michael@0: #include "nsIXULRuntime.h" michael@0: #include "nsDirectoryServiceUtils.h" michael@0: #include "nsDirectoryServiceDefs.h" michael@0: #include "nsXULAppAPI.h" michael@0: #include "nsIJSRuntimeService.h" michael@0: #include "nsIProfileSaveEvent.h" michael@0: michael@0: #ifdef XP_WIN michael@0: #include michael@0: #define getpid GetCurrentProcessId michael@0: #else michael@0: #include michael@0: #endif michael@0: michael@0: /** michael@0: * This is an event used to save the profile on the main thread michael@0: * to be sure that it is not being modified while saving. michael@0: */ michael@0: class SaveProfileTask : public nsRunnable { michael@0: public: michael@0: SaveProfileTask() {} michael@0: michael@0: NS_IMETHOD Run(); michael@0: }; michael@0: michael@0: class ProfileSaveEvent MOZ_FINAL : public nsIProfileSaveEvent { michael@0: public: michael@0: typedef void (*AddSubProfileFunc)(const char* aProfile, void* aClosure); michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: ProfileSaveEvent(AddSubProfileFunc aFunc, void* aClosure) michael@0: : mFunc(aFunc) michael@0: , mClosure(aClosure) michael@0: {} michael@0: michael@0: ~ProfileSaveEvent() {} michael@0: michael@0: NS_IMETHOD AddSubProfile(const char* aProfile); michael@0: private: michael@0: AddSubProfileFunc mFunc; michael@0: void* mClosure; michael@0: }; michael@0: michael@0: #endif michael@0: