OLD | NEW |
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 Loading... |
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 Loading... |
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" |
OLD | NEW |