OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. | 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "core/inspector/ConsoleMessage.h" | 41 #include "core/inspector/ConsoleMessage.h" |
42 #include "core/layout/LayoutImage.h" | 42 #include "core/layout/LayoutImage.h" |
43 #include "core/layout/LayoutPart.h" | 43 #include "core/layout/LayoutPart.h" |
44 #include "core/layout/api/LayoutEmbeddedItem.h" | 44 #include "core/layout/api/LayoutEmbeddedItem.h" |
45 #include "core/loader/MixedContentChecker.h" | 45 #include "core/loader/MixedContentChecker.h" |
46 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
47 #include "core/page/scrolling/ScrollingCoordinator.h" | 47 #include "core/page/scrolling/ScrollingCoordinator.h" |
48 #include "core/plugins/PluginView.h" | 48 #include "core/plugins/PluginView.h" |
49 #include "platform/FrameViewBase.h" | 49 #include "platform/FrameViewBase.h" |
50 #include "platform/Histogram.h" | 50 #include "platform/Histogram.h" |
| 51 #include "platform/bindings/V8PerIsolateData.h" |
51 #include "platform/loader/fetch/ResourceRequest.h" | 52 #include "platform/loader/fetch/ResourceRequest.h" |
52 #include "platform/network/mime/MIMETypeFromURL.h" | 53 #include "platform/network/mime/MIMETypeFromURL.h" |
53 #include "platform/network/mime/MIMETypeRegistry.h" | 54 #include "platform/network/mime/MIMETypeRegistry.h" |
54 #include "platform/plugins/PluginData.h" | 55 #include "platform/plugins/PluginData.h" |
55 #include "public/platform/WebURLRequest.h" | 56 #include "public/platform/WebURLRequest.h" |
56 | 57 |
57 namespace blink { | 58 namespace blink { |
58 | 59 |
59 using namespace HTMLNames; | 60 using namespace HTMLNames; |
60 | 61 |
(...skipping 18 matching lines...) Expand all Loading... |
79 is_delaying_load_event_(false), | 80 is_delaying_load_event_(false), |
80 // m_needsPluginUpdate(!createdByParser) allows HTMLObjectElement to delay | 81 // m_needsPluginUpdate(!createdByParser) allows HTMLObjectElement to delay |
81 // FrameViewBase updates until after all children are parsed. For | 82 // FrameViewBase updates until after all children are parsed. For |
82 // HTMLEmbedElement this delay is unnecessary, but it is simpler to make | 83 // HTMLEmbedElement this delay is unnecessary, but it is simpler to make |
83 // both classes share the same codepath in this class. | 84 // both classes share the same codepath in this class. |
84 needs_plugin_update_(!created_by_parser), | 85 needs_plugin_update_(!created_by_parser), |
85 should_prefer_plug_ins_for_images_(prefer_plug_ins_for_images_option == | 86 should_prefer_plug_ins_for_images_(prefer_plug_ins_for_images_option == |
86 kShouldPreferPlugInsForImages) {} | 87 kShouldPreferPlugInsForImages) {} |
87 | 88 |
88 HTMLPlugInElement::~HTMLPlugInElement() { | 89 HTMLPlugInElement::~HTMLPlugInElement() { |
89 DCHECK(!plugin_wrapper_); // cleared in detachLayoutTree() | 90 DCHECK(plugin_wrapper_.IsEmpty()); // cleared in detachLayoutTree() |
90 DCHECK(!is_delaying_load_event_); | 91 DCHECK(!is_delaying_load_event_); |
91 } | 92 } |
92 | 93 |
93 DEFINE_TRACE(HTMLPlugInElement) { | 94 DEFINE_TRACE(HTMLPlugInElement) { |
94 visitor->Trace(image_loader_); | 95 visitor->Trace(image_loader_); |
95 visitor->Trace(plugin_); | 96 visitor->Trace(plugin_); |
96 visitor->Trace(persisted_plugin_); | 97 visitor->Trace(persisted_plugin_); |
97 HTMLFrameOwnerElement::Trace(visitor); | 98 HTMLFrameOwnerElement::Trace(visitor); |
98 } | 99 } |
99 | 100 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 HTMLFrameOwnerElement::FinishParsingChildren(); | 359 HTMLFrameOwnerElement::FinishParsingChildren(); |
359 if (UseFallbackContent()) | 360 if (UseFallbackContent()) |
360 return; | 361 return; |
361 | 362 |
362 SetNeedsPluginUpdate(true); | 363 SetNeedsPluginUpdate(true); |
363 if (isConnected()) | 364 if (isConnected()) |
364 LazyReattachIfNeeded(); | 365 LazyReattachIfNeeded(); |
365 } | 366 } |
366 | 367 |
367 void HTMLPlugInElement::ResetInstance() { | 368 void HTMLPlugInElement::ResetInstance() { |
368 plugin_wrapper_.Clear(); | 369 plugin_wrapper_.Reset(); |
369 } | 370 } |
370 | 371 |
371 SharedPersistent<v8::Object>* HTMLPlugInElement::PluginWrapper() { | 372 v8::Local<v8::Object> HTMLPlugInElement::PluginWrapper() { |
372 LocalFrame* frame = GetDocument().GetFrame(); | 373 LocalFrame* frame = GetDocument().GetFrame(); |
373 if (!frame) | 374 if (!frame) |
374 return nullptr; | 375 return v8::Local<v8::Object>(); |
375 | 376 |
376 // If the host dynamically turns off JavaScript (or Java) we will still | 377 // If the host dynamically turns off JavaScript (or Java) we will still |
377 // return the cached allocated Bindings::Instance. Not supporting this | 378 // return the cached allocated Bindings::Instance. Not supporting this |
378 // edge-case is OK. | 379 // edge-case is OK. |
379 if (!plugin_wrapper_) { | 380 v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate(); |
| 381 if (plugin_wrapper_.IsEmpty()) { |
380 PluginView* plugin; | 382 PluginView* plugin; |
381 | 383 |
382 if (persisted_plugin_) | 384 if (persisted_plugin_) |
383 plugin = persisted_plugin_.Get(); | 385 plugin = persisted_plugin_.Get(); |
384 else | 386 else |
385 plugin = PluginWidget(); | 387 plugin = PluginWidget(); |
386 | 388 |
387 if (plugin) { | 389 if (plugin) |
388 plugin_wrapper_ = | 390 plugin_wrapper_.Reset(isolate, plugin->ScriptableObject(isolate)); |
389 frame->GetScriptController().CreatePluginWrapper(*plugin); | |
390 } | |
391 } | 391 } |
392 return plugin_wrapper_.Get(); | 392 return plugin_wrapper_.Get(isolate); |
393 } | 393 } |
394 | 394 |
395 PluginView* HTMLPlugInElement::PluginWidget() const { | 395 PluginView* HTMLPlugInElement::PluginWidget() const { |
396 if (LayoutPart* layout_part = LayoutPartForJSBindings()) | 396 if (LayoutPart* layout_part = LayoutPartForJSBindings()) |
397 return layout_part->Plugin(); | 397 return layout_part->Plugin(); |
398 return nullptr; | 398 return nullptr; |
399 } | 399 } |
400 | 400 |
401 PluginView* HTMLPlugInElement::Plugin() const { | 401 PluginView* HTMLPlugInElement::Plugin() const { |
402 return plugin_.Get(); | 402 return plugin_.Get(); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 707 |
708 void HTMLPlugInElement::LazyReattachIfNeeded() { | 708 void HTMLPlugInElement::LazyReattachIfNeeded() { |
709 if (!UseFallbackContent() && NeedsPluginUpdate() && GetLayoutObject() && | 709 if (!UseFallbackContent() && NeedsPluginUpdate() && GetLayoutObject() && |
710 !IsImageType()) { | 710 !IsImageType()) { |
711 LazyReattachIfAttached(); | 711 LazyReattachIfAttached(); |
712 SetPersistedPlugin(nullptr); | 712 SetPersistedPlugin(nullptr); |
713 } | 713 } |
714 } | 714 } |
715 | 715 |
716 } // namespace blink | 716 } // namespace blink |
OLD | NEW |