diff options
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 64 | ||||
-rw-r--r-- | chrome_frame/chrome_active_document.h | 2 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.cc | 28 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.h | 5 |
4 files changed, 8 insertions, 91 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index f06a53a..49085d3 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -19,17 +19,10 @@ #include "base/command_line.h" #include "base/debug/trace_event.h" -#include "base/file_util.h" #include "base/logging.h" -#include "base/path_service.h" -#include "base/process_util.h" -#include "base/string_tokenizer.h" #include "base/string_util.h" -#include "base/threading/thread.h" -#include "base/threading/thread_local.h" #include "base/utf_string_conversions.h" #include "base/win/scoped_variant.h" -#include "base/win/win_util.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/common/automation_messages.h" @@ -49,8 +42,6 @@ DEFINE_GUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46); -base::ThreadLocalPointer<ChromeActiveDocument> g_active_doc_cache; - bool g_first_launch_by_process_ = true; const DWORD kIEEncodingIdArray[] = { @@ -73,29 +64,14 @@ ChromeActiveDocument::ChromeActiveDocument() } HRESULT ChromeActiveDocument::FinalConstruct() { - // If we have a cached ChromeActiveDocument instance in TLS, then grab - // ownership of the cached document's automation client. This is an - // optimization to get Chrome active documents to load faster. - ChromeActiveDocument* cached_document = g_active_doc_cache.Get(); - if (cached_document && cached_document->IsValid()) { - SetResourceModule(); - DCHECK(automation_client_.get() == NULL); - automation_client_.swap(cached_document->automation_client_); - DVLOG(1) << "Reusing automation client instance from " << cached_document; - DCHECK(automation_client_.get() != NULL); - automation_client_->Reinitialize(this, url_fetcher_.get()); - is_automation_client_reused_ = true; - OnAutomationServerReady(); - } else { - // The FinalConstruct implementation in the ChromeFrameActivexBase class - // i.e. Base creates an instance of the ChromeFrameAutomationClient class - // and initializes it, which would spawn a new Chrome process, etc. - // We don't want to be doing this if we have a cached document, whose - // automation client instance can be reused. - HRESULT hr = BaseActiveX::FinalConstruct(); - if (FAILED(hr)) - return hr; - } + // The FinalConstruct implementation in the ChromeFrameActivexBase class + // i.e. Base creates an instance of the ChromeFrameAutomationClient class + // and initializes it, which would spawn a new Chrome process, etc. + // We don't want to be doing this if we have a cached document, whose + // automation client instance can be reused. + HRESULT hr = BaseActiveX::FinalConstruct(); + if (FAILED(hr)) + return hr; InitializeAutomationSettings(); @@ -543,13 +519,6 @@ HRESULT ChromeActiveDocument::GetInPlaceFrame( HRESULT ChromeActiveDocument::IOleObject_SetClientSite( IOleClientSite* client_site) { if (client_site == NULL) { - ChromeActiveDocument* cached_document = g_active_doc_cache.Get(); - if (cached_document) { - DCHECK(this == cached_document); - g_active_doc_cache.Set(NULL); - cached_document->Release(); - } - base::win::ScopedComPtr<IDocHostUIHandler> doc_host_handler; if (doc_site_) doc_host_handler.QueryFrom(doc_site_); @@ -974,23 +943,6 @@ void ChromeActiveDocument::OnUnload(const GUID* cmd_group_guid, } } -void ChromeActiveDocument::OnOpenURL(const GURL& url_to_open, - const GURL& referrer, - int open_disposition) { - // If the disposition indicates that we should be opening the URL in the - // current tab, then we can reuse the ChromeFrameAutomationClient instance - // maintained by the current ChromeActiveDocument instance. We cache this - // instance so that it can be used by the new ChromeActiveDocument instance - // which may be instantiated for handling the new URL. - if (open_disposition == CURRENT_TAB) { - // Grab a reference to ensure that the document remains valid. - AddRef(); - g_active_doc_cache.Set(this); - } - - BaseActiveX::OnOpenURL(url_to_open, referrer, open_disposition); -} - void ChromeActiveDocument::OnAttachExternalTab( const AttachExternalTabParams& params) { if (!automation_client_.get()) { diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h index 5440528..96232c6 100644 --- a/chrome_frame/chrome_active_document.h +++ b/chrome_frame/chrome_active_document.h @@ -361,8 +361,6 @@ END_EXEC_COMMAND_MAP() protected: // ChromeFrameActivexBase overrides - virtual void OnOpenURL( - const GURL& url_to_open, const GURL& referrer, int open_disposition); virtual void OnAttachExternalTab(const AttachExternalTabParams& params); virtual void OnGoToHistoryEntryOffset(int offset); virtual void OnMoveWindow(const gfx::Rect& dimensions); diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index 252f8fb..792f047 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -1163,34 +1163,6 @@ void ChromeFrameAutomationClient::PrintTab() { tab_->PrintAsync(); } -bool ChromeFrameAutomationClient::Reinitialize( - ChromeFrameDelegate* delegate, - PluginUrlRequestManager* url_fetcher) { - if (url_fetcher_) { - // Clean up any outstanding requests - url_fetcher_->StopAllRequests(); - url_fetcher_ = NULL; - } - - if (!tab_.get() || !::IsWindow(chrome_window_)) { - NOTREACHED(); - DLOG(WARNING) << "ChromeFrameAutomationClient instance reused " - << "with invalid tab"; - return false; - } - - if (!delegate) { - NOTREACHED(); - return false; - } - - chrome_frame_delegate_ = delegate; - DeleteAllPendingTasks(); - SetUrlFetcher(url_fetcher); - SetParentWindow(NULL); - return true; -} - void ChromeFrameAutomationClient::AttachExternalTab( uint64 external_tab_cookie) { DCHECK_EQ(static_cast<TabProxy*>(NULL), tab_.get()); diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h index 1d4a70f..5209c35 100644 --- a/chrome_frame/chrome_frame_automation.h +++ b/chrome_frame/chrome_frame_automation.h @@ -389,11 +389,6 @@ class ChromeFrameAutomationClient // Url request manager set up. void SetUrlFetcher(PluginUrlRequestManager* url_fetcher); - // Called if the same instance of the ChromeFrameAutomationClient object - // is reused. - bool Reinitialize(ChromeFrameDelegate* chrome_frame_delegate, - PluginUrlRequestManager* url_fetcher); - // Attaches an existing external tab to this automation client instance. void AttachExternalTab(uint64 external_tab_cookie); void BlockExternalTab(uint64 cookie); |