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

Side by Side Diff: chrome/browser/guest_view/guest_view_base.cc

Issue 298913003: Do not allow GuestViewManager to (re)use an instance ID that was already removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 6 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/guest_view/guest_view_manager.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/guest_view/guest_view_base.h" 5 #include "chrome/browser/guest_view/guest_view_base.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h" 8 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h"
9 #include "chrome/browser/guest_view/guest_view_constants.h" 9 #include "chrome/browser/guest_view/guest_view_constants.h"
10 #include "chrome/browser/guest_view/guest_view_manager.h" 10 #include "chrome/browser/guest_view/guest_view_manager.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 : guest_web_contents_(guest_web_contents), 45 : guest_web_contents_(guest_web_contents),
46 embedder_web_contents_(NULL), 46 embedder_web_contents_(NULL),
47 embedder_extension_id_(embedder_extension_id), 47 embedder_extension_id_(embedder_extension_id),
48 embedder_render_process_id_(0), 48 embedder_render_process_id_(0),
49 browser_context_(guest_web_contents->GetBrowserContext()), 49 browser_context_(guest_web_contents->GetBrowserContext()),
50 guest_instance_id_(guest_instance_id), 50 guest_instance_id_(guest_instance_id),
51 view_instance_id_(guestview::kInstanceIDNone), 51 view_instance_id_(guestview::kInstanceIDNone),
52 weak_ptr_factory_(this) { 52 weak_ptr_factory_(this) {
53 webcontents_guestview_map.Get().insert( 53 webcontents_guestview_map.Get().insert(
54 std::make_pair(guest_web_contents, this)); 54 std::make_pair(guest_web_contents, this));
55 GuestViewManager::FromBrowserContext(browser_context_)-> 55 DCHECK(GuestViewManager::FromBrowserContext(browser_context_)
lazyboy 2014/05/22 15:59:31 Q: Do we need a CHECK here too?
Fady Samuel 2014/05/22 17:41:53 If we have a CHECK inside AddGuest then why do we
lazyboy 2014/05/22 18:34:45 The return value was for test, I've moved the logi
56 AddGuest(guest_instance_id_, guest_web_contents); 56 ->AddGuest(guest_instance_id_, guest_web_contents));
57 } 57 }
58 58
59 // static 59 // static
60 GuestViewBase* GuestViewBase::Create( 60 GuestViewBase* GuestViewBase::Create(
61 int guest_instance_id, 61 int guest_instance_id,
62 WebContents* guest_web_contents, 62 WebContents* guest_web_contents,
63 const std::string& embedder_extension_id, 63 const std::string& embedder_extension_id,
64 const std::string& view_type) { 64 const std::string& view_type) {
65 if (view_type == "webview") { 65 if (view_type == "webview") {
66 return new WebViewGuest(guest_instance_id, 66 return new WebViewGuest(guest_instance_id,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 void GuestViewBase::SendQueuedEvents() { 233 void GuestViewBase::SendQueuedEvents() {
234 if (!attached()) 234 if (!attached())
235 return; 235 return;
236 while (!pending_events_.empty()) { 236 while (!pending_events_.empty()) {
237 linked_ptr<Event> event_ptr = pending_events_.front(); 237 linked_ptr<Event> event_ptr = pending_events_.front();
238 pending_events_.pop_front(); 238 pending_events_.pop_front();
239 DispatchEvent(event_ptr.release()); 239 DispatchEvent(event_ptr.release());
240 } 240 }
241 } 241 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/guest_view/guest_view_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698