1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // MeasurePageLoadTime.cpp : Implementation of DLL Exports. 6 7 #include "stdafx.h" 8 #include "resource.h" 9 #include "MeasurePageLoadTime.h" 10 11 12 class CMeasurePageLoadTimeModule : public CAtlDllModuleT< CMeasurePageLoadTimeModule > 13 { 14 public : 15 DECLARE_LIBID(LIBID_MeasurePageLoadTimeLib) 16 DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MEASUREPAGELOADTIME, "{56C6D9F9-643C-4F6E-906C-5F7CECB23C24}") 17 }; 18 19 CMeasurePageLoadTimeModule _AtlModule; 20 21 22 #ifdef _MANAGED 23 #pragma managed(push, off) 24 #endif 25 26 // DLL Entry Point 27 extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 28 { 29 if (dwReason == DLL_PROCESS_ATTACH) 30 { 31 DisableThreadLibraryCalls(hInstance); 32 } 33 return _AtlModule.DllMain(dwReason, lpReserved); 34 } 35 36 #ifdef _MANAGED 37 #pragma managed(pop) 38 #endif 39 40 41 42 43 // Used to determine whether the DLL can be unloaded by OLE 44 STDAPI DllCanUnloadNow(void) 45 { 46 return _AtlModule.DllCanUnloadNow(); 47 } 48 49 50 // Returns a class factory to create an object of the requested type 51 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) 52 { 53 return _AtlModule.DllGetClassObject(rclsid, riid, ppv); 54 } 55 56 57 // DllRegisterServer - Adds entries to the system registry 58 STDAPI DllRegisterServer(void) 59 { 60 // registers object, typelib and all interfaces in typelib 61 HRESULT hr = _AtlModule.DllRegisterServer(); 62 return hr; 63 } 64 65 66 // DllUnregisterServer - Removes entries from the system registry 67 STDAPI DllUnregisterServer(void) 68 { 69 HRESULT hr = _AtlModule.DllUnregisterServer(); 70 return hr; 71 } 72 73