Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: third_party/lzma/v4_65/files/CPP/Windows/System.cpp

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Windows/System.cpp
2
3 #include "StdAfx.h"
4
5 #include "System.h"
6
7 namespace NWindows {
8 namespace NSystem {
9
10 UInt32 GetNumberOfProcessors()
11 {
12 SYSTEM_INFO systemInfo;
13 GetSystemInfo(&systemInfo);
14 return (UInt32)systemInfo.dwNumberOfProcessors;
15 }
16
17 #if !defined(_WIN64) && defined(__GNUC__)
18
19 typedef struct _MY_MEMORYSTATUSEX {
20 DWORD dwLength;
21 DWORD dwMemoryLoad;
22 DWORDLONG ullTotalPhys;
23 DWORDLONG ullAvailPhys;
24 DWORDLONG ullTotalPageFile;
25 DWORDLONG ullAvailPageFile;
26 DWORDLONG ullTotalVirtual;
27 DWORDLONG ullAvailVirtual;
28 DWORDLONG ullAvailExtendedVirtual;
29 } MY_MEMORYSTATUSEX, *MY_LPMEMORYSTATUSEX;
30
31 #else
32
33 #define MY_MEMORYSTATUSEX MEMORYSTATUSEX
34 #define MY_LPMEMORYSTATUSEX LPMEMORYSTATUSEX
35
36 #endif
37
38 typedef BOOL (WINAPI *GlobalMemoryStatusExP)(MY_LPMEMORYSTATUSEX lpBuffer);
39
40 UInt64 GetRamSize()
41 {
42 MY_MEMORYSTATUSEX stat;
43 stat.dwLength = sizeof(stat);
44 #ifdef _WIN64
45 if (!::GlobalMemoryStatusEx(&stat))
46 return 0;
47 return stat.ullTotalPhys;
48 #else
49 GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP)
50 ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
51 "GlobalMemoryStatusEx");
52 if (globalMemoryStatusEx != 0)
53 if (globalMemoryStatusEx(&stat))
54 return stat.ullTotalPhys;
55 {
56 MEMORYSTATUS stat;
57 stat.dwLength = sizeof(stat);
58 GlobalMemoryStatus(&stat);
59 return stat.dwTotalPhys;
60 }
61 #endif
62 }
63
64 }}
OLDNEW
« no previous file with comments | « third_party/lzma/v4_65/files/CPP/Windows/System.h ('k') | third_party/lzma/v4_65/files/CPP/Windows/Thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698