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

Unified Diff: runtime/bin/extensions_win.cc

Issue 1401253004: Cleanup the extensions code to avoid the duplication that was introduced in the quick fix to turn t… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/extensions_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/extensions_win.cc
diff --git a/runtime/bin/extensions_win.cc b/runtime/bin/extensions_win.cc
index 33e3273cd95ab4d235aba404e5df8d7aed18569c..d3b49f2a98839d6b011529e332fc80fcb8487ac3 100644
--- a/runtime/bin/extensions_win.cc
+++ b/runtime/bin/extensions_win.cc
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#include "platform/assert.h"
#include "platform/globals.h"
#if defined(TARGET_OS_WINDOWS)
@@ -17,38 +16,25 @@ namespace bin {
const char* kPrecompiledLibraryName = "precompiled.dll";
const char* kPrecompiledSymbolName = "_kInstructionsSnapshot";
-Dart_Handle Extensions::LoadExtensionLibrary(const char* library_file,
- void** library_handle) {
- ASSERT(library_handle != NULL);
- *library_handle = LoadLibraryW(StringUtilsWin::Utf8ToWide(library_file));
- if (*library_handle == NULL) {
- OSError err;
- return Dart_NewApiError(err.message());
- }
- return Dart_Null();
-}
-
void* Extensions::LoadExtensionLibrary(const char* library_file) {
+ SetLastError(0);
return LoadLibraryW(StringUtilsWin::Utf8ToWide(library_file));
}
-Dart_Handle Extensions::ResolveSymbol(void* lib_handle,
- const char* symbol,
- void** init_function) {
- ASSERT(init_function != NULL);
- *init_function = GetProcAddress(
- reinterpret_cast<HMODULE>(lib_handle), symbol);
- if (*init_function == NULL) {
+void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
+ SetLastError(0);
+ return GetProcAddress(reinterpret_cast<HMODULE>(lib_handle), symbol);
+}
+
+Dart_Handle Extensions::GetError() {
+ int last_error = GetLastError();
+ if (last_error != 0) {
OSError err;
return Dart_NewApiError(err.message());
}
return Dart_Null();
}
-void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
- return GetProcAddress(reinterpret_cast<HMODULE>(lib_handle), symbol);
-}
-
} // namespace bin
} // namespace dart
« no previous file with comments | « runtime/bin/extensions_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698