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

Side by Side Diff: chrome_frame/bind_context_info.cc

Issue 3031009: A different approach to avoid crashes in buggy 3rd party BHOs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | chrome_frame/buggy_bho_handling.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome_frame/bind_context_info.h" 5 #include "chrome_frame/bind_context_info.h"
6 #include "chrome_frame/utils.h" 6 #include "chrome_frame/utils.h"
7 7
8 // This is non const due to API expectations 8 // This is non const due to API expectations
9 static wchar_t* kBindContextInfo = L"_CHROMEFRAME_BIND_CONTEXT_INFO_"; 9 static wchar_t* kBindContextInfo = L"_CHROMEFRAME_BIND_CONTEXT_INFO_";
10 10
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 ScopedComPtr<IUnknown> context; 42 ScopedComPtr<IUnknown> context;
43 HRESULT hr = bind_context->GetObjectParam(kBindContextInfo, 43 HRESULT hr = bind_context->GetObjectParam(kBindContextInfo,
44 context.Receive()); 44 context.Receive());
45 if (context) { 45 if (context) {
46 ScopedComPtr<IBindContextInfoInternal> internal; 46 ScopedComPtr<IBindContextInfoInternal> internal;
47 hr = internal.QueryFrom(context); 47 hr = internal.QueryFrom(context);
48 DCHECK(SUCCEEDED(hr)); 48 DCHECK(SUCCEEDED(hr));
49 if (SUCCEEDED(hr)) { 49 if (SUCCEEDED(hr)) {
50 BindContextInfo* ret = NULL;
51 hr = internal->GetCppObject(reinterpret_cast<void**>(info)); 50 hr = internal->GetCppObject(reinterpret_cast<void**>(info));
52 DCHECK_EQ(hr, S_OK); 51 DCHECK_EQ(hr, S_OK);
52 DLOG_IF(ERROR, *info != static_cast<BindContextInfo*>(internal.get()))
53 << "marshalling took place!";
53 } 54 }
54 } else { 55 } else {
55 DCHECK(FAILED(hr)); 56 DCHECK(FAILED(hr));
56 CComObject<BindContextInfo>* bind_context_info = NULL; 57 CComObject<BindContextInfo>* bind_context_info = NULL;
57 hr = CComObject<BindContextInfo>::CreateInstance(&bind_context_info); 58 hr = CComObject<BindContextInfo>::CreateInstance(&bind_context_info);
58 DCHECK(bind_context_info != NULL); 59 DCHECK(bind_context_info != NULL);
59 if (bind_context_info) { 60 if (bind_context_info) {
60 bind_context_info->AddRef(); 61 bind_context_info->AddRef();
61 hr = bind_context_info->Initialize(bind_context); 62 hr = bind_context_info->Initialize(bind_context);
62 if (FAILED(hr)) { 63 if (FAILED(hr)) {
63 bind_context_info->Release(); 64 bind_context_info->Release();
64 } else { 65 } else {
65 *info = bind_context_info; 66 *info = bind_context_info;
66 } 67 }
67 } 68 }
68 } 69 }
69 70
70 return hr; 71 return hr;
71 } 72 }
72 73
73 void BindContextInfo::SetToSwitch(IStream* cache) { 74 void BindContextInfo::SetToSwitch(IStream* cache) {
74 is_switching_ = true; 75 is_switching_ = true;
75 if (!no_cache_) { 76 if (!no_cache_) {
76 cache_ = cache; 77 cache_ = cache;
77 RewindStream(cache_); 78 RewindStream(cache_);
78 } 79 }
79 } 80 }
80 81
OLDNEW
« no previous file with comments | « no previous file | chrome_frame/buggy_bho_handling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698