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

Side by Side Diff: plugin/win/main_win.cc

Issue 155119: Worked around infinite loop seen in Chrome on Windows when raising and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 466
467 // Limit the ways in which we can be reentrant. Note that this WindowProc 467 // Limit the ways in which we can be reentrant. Note that this WindowProc
468 // may be called by different threads. For example, IE will register plugin 468 // may be called by different threads. For example, IE will register plugin
469 // instances on separate threads. 469 // instances on separate threads.
470 o3d::Client::ScopedIncrement reentrance_count(obj->client()); 470 o3d::Client::ScopedIncrement reentrance_count(obj->client());
471 471
472 switch (Msg) { 472 switch (Msg) {
473 case WM_PAINT: { 473 case WM_PAINT: {
474 if (reentrance_count.get() > 1) { 474 if (reentrance_count.get() > 1) {
475 // In Chrome, alert dialogs raised from JavaScript cause
476 // reentrant WM_PAINT messages to be dispatched and 100% CPU
477 // to be consumed unless we call this
478 ::ValidateRect(hWnd, NULL);
475 break; // Ignore this message; we're reentrant. 479 break; // Ignore this message; we're reentrant.
476 } 480 }
477 PAINTSTRUCT paint_struct; 481 PAINTSTRUCT paint_struct;
478 HDC hdc = ::BeginPaint(hWnd, &paint_struct); 482 HDC hdc = ::BeginPaint(hWnd, &paint_struct);
479 if (paint_struct.rcPaint.right - paint_struct.rcPaint.left != 0 || 483 if (paint_struct.rcPaint.right - paint_struct.rcPaint.left != 0 ||
480 paint_struct.rcPaint.bottom - paint_struct.rcPaint.top != 0) { 484 paint_struct.rcPaint.bottom - paint_struct.rcPaint.top != 0) {
481 if (obj->renderer()) { 485 if (obj->renderer()) {
482 // It appears to be necessary to use GDI to paint something at least 486 // It appears to be necessary to use GDI to paint something at least
483 // once before D3D rendering will work in Vista with Aero. 487 // once before D3D rendering will work in Vista with Aero.
484 if (!obj->RecordPaint()) { 488 if (!obj->RecordPaint()) {
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 StreamManager *stream_manager = obj->stream_manager(); 979 StreamManager *stream_manager = obj->stream_manager();
976 980
977 stream_manager->SetStreamFile(stream, fname); 981 stream_manager->SetStreamFile(stream, fname);
978 } 982 }
979 983
980 int16 NPP_HandleEvent(NPP instance, void *event) { 984 int16 NPP_HandleEvent(NPP instance, void *event) {
981 HANDLE_CRASHES; 985 HANDLE_CRASHES;
982 return 0; 986 return 0;
983 } 987 }
984 } // end extern "C" 988 } // end extern "C"
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698