OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "webkit/glue/plugins/plugin_instance.h" | 7 #include "webkit/glue/plugins/plugin_instance.h" |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 358 } |
359 | 359 |
360 void PluginInstance::PluginThreadAsyncCall(void (*func)(void *), | 360 void PluginInstance::PluginThreadAsyncCall(void (*func)(void *), |
361 void *user_data) { | 361 void *user_data) { |
362 message_loop_->PostTask(FROM_HERE, NewRunnableMethod( | 362 message_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
363 this, &PluginInstance::OnPluginThreadAsyncCall, func, user_data)); | 363 this, &PluginInstance::OnPluginThreadAsyncCall, func, user_data)); |
364 } | 364 } |
365 | 365 |
366 void PluginInstance::OnPluginThreadAsyncCall(void (*func)(void *), | 366 void PluginInstance::OnPluginThreadAsyncCall(void (*func)(void *), |
367 void *user_data) { | 367 void *user_data) { |
368 func(user_data); | 368 // Do not invoke the callback if NPP_Destroy has already been invoked. |
| 369 if (webplugin_) |
| 370 func(user_data); |
369 } | 371 } |
370 | 372 |
371 uint32 PluginInstance::ScheduleTimer(uint32 interval, | 373 uint32 PluginInstance::ScheduleTimer(uint32 interval, |
372 NPBool repeat, | 374 NPBool repeat, |
373 void (*func)(NPP id, uint32 timer_id)) { | 375 void (*func)(NPP id, uint32 timer_id)) { |
374 // Use next timer id. | 376 // Use next timer id. |
375 uint32 timer_id; | 377 uint32 timer_id; |
376 timer_id = next_timer_id_; | 378 timer_id = next_timer_id_; |
377 ++next_timer_id_; | 379 ++next_timer_id_; |
378 DCHECK(next_timer_id_ != 0); | 380 DCHECK(next_timer_id_ != 0); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 stream->url, range_info.c_str(), | 484 stream->url, range_info.c_str(), |
483 reinterpret_cast<intptr_t>(plugin_stream), | 485 reinterpret_cast<intptr_t>(plugin_stream), |
484 plugin_stream->notify_needed(), | 486 plugin_stream->notify_needed(), |
485 reinterpret_cast<intptr_t>(plugin_stream->notify_data())); | 487 reinterpret_cast<intptr_t>(plugin_stream->notify_data())); |
486 break; | 488 break; |
487 } | 489 } |
488 } | 490 } |
489 } | 491 } |
490 | 492 |
491 } // namespace NPAPI | 493 } // namespace NPAPI |
OLD | NEW |