summaryrefslogtreecommitdiffstats
path: root/o3d/plugin/win
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-03 19:49:35 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-03 19:49:35 +0000
commit91240c947358b33cc19c0923a06d116ab36737dd (patch)
tree7897c99ad9b41d7735c7a42e0ea75fe6f76760b3 /o3d/plugin/win
parent2e25a9f4152a90a179ad37206bff79e1198379d7 (diff)
downloadchromium_src-91240c947358b33cc19c0923a06d116ab36737dd.zip
chromium_src-91240c947358b33cc19c0923a06d116ab36737dd.tar.gz
chromium_src-91240c947358b33cc19c0923a06d116ab36737dd.tar.bz2
Asynchronous tick now uses NPN_PluginAsyncCall.URL streaming callbacks are now also asynchronous.Implemented NPN_PluginAsyncCall for IE.Allowed WM_PAINT handler to be reentered because it no longer calls into the browser (except to schedule an asynchronous tick if none is pending).Fixed a bug where the EventManager would crash if an event callback called cleanUp on the client.Cleanup destroys all the packs. Doing this in NPP_Destroy seems to make Chrome timeout and fail to load the next page.Tar and GZ decoding happens on a new thread.
Review URL: http://codereview.chromium.org/155733 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin/win')
-rw-r--r--o3d/plugin/win/main_win.cc28
1 files changed, 8 insertions, 20 deletions
diff --git a/o3d/plugin/win/main_win.cc b/o3d/plugin/win/main_win.cc
index 69cd647..f2feeae 100644
--- a/o3d/plugin/win/main_win.cc
+++ b/o3d/plugin/win/main_win.cc
@@ -90,9 +90,12 @@ namespace {
const wchar_t* const kFullScreenWindowClassName = L"O3DFullScreenWindowClass";
// We would normally make this a stack variable in main(), but in a
-// plugin, that's not possible, so we allocate it dynamically and
-// destroy it explicitly.
-scoped_ptr<base::AtExitManager> g_at_exit_manager;
+// plugin, that's not possible, so we make it a global. When the DLL is loaded
+// this it gets constructed and when it is unlooaded it is destructed. Note
+// that this cannot be done in NP_Initialize and NP_Shutdown because those
+// calls do not necessarily signify the DLL being loaded and unloaded. If the
+// DLL is not unloaded then the values of global variables are preserved.
+base::AtExitManager g_at_exit_manager;
static int HandleKeyboardEvent(PluginObject *obj,
HWND hWnd,
@@ -494,13 +497,6 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
switch (Msg) {
case WM_PAINT: {
- if (reentrance_count.get() > 1) {
- // In Chrome, alert dialogs raised from JavaScript cause
- // reentrant WM_PAINT messages to be dispatched and 100% CPU
- // to be consumed unless we call this
- ::ValidateRect(hWnd, NULL);
- break; // Ignore this message; we're reentrant.
- }
PAINTSTRUCT paint_struct;
HDC hdc = ::BeginPaint(hWnd, &paint_struct);
if (paint_struct.rcPaint.right - paint_struct.rcPaint.left != 0 ||
@@ -564,7 +560,6 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
// repaint the window.
if (obj->client()->render_mode() == o3d::Client::RENDERMODE_CONTINUOUS) {
InvalidateRect(obj->GetHWnd(), NULL, FALSE);
- reentrance_count.decrement();
UpdateWindow(obj->GetHWnd());
}
@@ -691,10 +686,6 @@ NPError InitializePlugin() {
g_exception_manager->StartMonitoring();
}
- // Initialize the AtExitManager so that base singletons can be
- // destroyed properly.
- g_at_exit_manager.reset(new base::AtExitManager());
-
// Turn on the logging.
CommandLine::Init(0, NULL);
InitLogging(L"debug.log",
@@ -791,9 +782,6 @@ NPError OSCALL NP_Shutdown(void) {
CommandLine::Terminate();
- // Force all base singletons to be destroyed.
- g_at_exit_manager.reset(NULL);
-
// TODO : This is commented out until we can determine if
// it's safe to shutdown breakpad at this stage (Gears, for
// example, never deletes...)
@@ -891,10 +879,10 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window) {
DCHECK(obj->GetPluginHWnd());
DCHECK(obj->GetFullscreenHWnd());
DCHECK(obj->GetPluginHWnd() == hWnd);
-
+
// Exit full screen if the plugin window is being modified.
obj->CancelFullscreenDisplay();
-
+
return NPERR_NO_ERROR;
}
DCHECK(!obj->GetPluginHWnd());