]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - wtf/win/MainThreadWin.cpp
JavaScriptCore-903.tar.gz
[apple/javascriptcore.git] / wtf / win / MainThreadWin.cpp
index 5f0163c00a3aa69618033ffff4ceff9659c26ef8..ee3a273776b0df3fe69fd631cc1827bb0e797456 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +32,7 @@
 
 #include "Assertions.h"
 #include "Threading.h"
-#if !PLATFORM(WIN_CE)
+#if !OS(WINCE)
 #include <windows.h>
 #endif
 
@@ -50,23 +51,34 @@ LRESULT CALLBACK ThreadingWindowWndProc(HWND hWnd, UINT message, WPARAM wParam,
     return 0;
 }
 
-void initializeMainThread()
+void initializeMainThreadPlatform()
 {
     if (threadingWindowHandle)
         return;
 
-    mainThreadFunctionQueueMutex();
-
+    HWND hWndParent = 0;
+#if OS(WINCE)
+    WNDCLASS wcex;
+    memset(&wcex, 0, sizeof(WNDCLASS));
+#else
     WNDCLASSEX wcex;
     memset(&wcex, 0, sizeof(WNDCLASSEX));
     wcex.cbSize = sizeof(WNDCLASSEX);
+#endif
     wcex.lpfnWndProc    = ThreadingWindowWndProc;
     wcex.lpszClassName  = kThreadingWindowClassName;
+#if OS(WINCE)
+    RegisterClass(&wcex);
+#else
     RegisterClassEx(&wcex);
+    hWndParent = HWND_MESSAGE;
+#endif
 
     threadingWindowHandle = CreateWindow(kThreadingWindowClassName, 0, 0,
-       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_MESSAGE, 0, 0, 0);
+       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWndParent, 0, 0, 0);
     threadingFiredMessage = RegisterWindowMessage(L"com.apple.WebKit.MainThreadFired");
+
+    initializeCurrentThreadInternal("Main Thread");
 }
 
 void scheduleDispatchFunctionsOnMainThread()
@@ -75,4 +87,4 @@ void scheduleDispatchFunctionsOnMainThread()
     PostMessage(threadingWindowHandle, threadingFiredMessage, 0, 0);
 }
 
-} // namespace WebCore
+} // namespace WTF