Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: installer/src/installer-lib/process.cpp

Issue 6197445574787072: Cleaned up CA exceptions. Integrated free-standing handle class. (Closed)
Patch Set: Created March 30, 2014, 7:43 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: installer/src/installer-lib/process.cpp
===================================================================
--- a/installer/src/installer-lib/process.cpp
+++ b/installer/src/installer-lib/process.cpp
@@ -4,38 +4,10 @@
// <thread> is C++11, but implemented in VS2012
#include <thread>
+#include "installer-lib.h"
#include "process.h"
//-------------------------------------------------------
-// Windows_Handle
-//-------------------------------------------------------
-Windows_Handle::Windows_Handle( HANDLE h )
- : handle( h )
-{
- validate_handle() ;
-}
-
-Windows_Handle::~Windows_Handle()
-{
- CloseHandle( handle ) ;
-}
-
-void Windows_Handle::operator=( HANDLE h )
-{
- this -> ~Windows_Handle() ;
- handle = h ;
- validate_handle() ;
-}
-
-void Windows_Handle::validate_handle()
-{
- if ( handle == INVALID_HANDLE_VALUE )
- {
- throw std::runtime_error( "Invalid handle" ) ;
- }
-}
-
-//-------------------------------------------------------
// process_by_name_CI
//-------------------------------------------------------
process_by_name_CI::process_by_name_CI( const wchar_t * name )
@@ -131,7 +103,7 @@
{
// Assert GetWindowThreadProcessId returned an error
// If the window handle is invalid, we end up here.
- throw std::runtime_error( "" ) ;
+ throw windows_api_error( "GetWindowThreadProcessId", r ) ;
}
return pid ;
}

Powered by Google App Engine
This is Rietveld