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

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.cc

Issue 320713003: Fixes crash in view_manager_lib (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | no next file » | 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 "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h" 5 #include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/public/cpp/application/connect.h" 9 #include "mojo/public/cpp/application/connect.h"
10 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" 10 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManagerDelegate* delegate) 440 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManagerDelegate* delegate)
441 : view_manager_(new ViewManager(this, delegate)), 441 : view_manager_(new ViewManager(this, delegate)),
442 connected_(false), 442 connected_(false),
443 connection_id_(0), 443 connection_id_(0),
444 next_id_(1), 444 next_id_(1),
445 next_server_change_id_(0), 445 next_server_change_id_(0),
446 sync_factory_(this) { 446 sync_factory_(this) {
447 } 447 }
448 448
449 ViewManagerSynchronizer::~ViewManagerSynchronizer() { 449 ViewManagerSynchronizer::~ViewManagerSynchronizer() {
450 // Destroying the |view_manager_| may attempt to add transactions to
451 // |pending_transactions_|. So we need to destroy |view_manager_| first.
452 view_manager_.reset();
450 } 453 }
451 454
452 TransportNodeId ViewManagerSynchronizer::CreateViewTreeNode() { 455 TransportNodeId ViewManagerSynchronizer::CreateViewTreeNode() {
453 DCHECK(connected_); 456 DCHECK(connected_);
454 const TransportNodeId node_id( 457 const TransportNodeId node_id(
455 MakeTransportId(connection_id_, ++next_id_)); 458 MakeTransportId(connection_id_, ++next_id_));
456 pending_transactions_.push_back( 459 pending_transactions_.push_back(
457 new CreateViewTreeNodeTransaction(node_id, this)); 460 new CreateViewTreeNodeTransaction(node_id, this));
458 Sync(); 461 Sync();
459 return node_id; 462 return node_id;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 void ViewManagerSynchronizer::RemoveFromPendingQueue( 672 void ViewManagerSynchronizer::RemoveFromPendingQueue(
670 ViewManagerTransaction* transaction) { 673 ViewManagerTransaction* transaction) {
671 DCHECK_EQ(transaction, pending_transactions_.front()); 674 DCHECK_EQ(transaction, pending_transactions_.front());
672 pending_transactions_.erase(pending_transactions_.begin()); 675 pending_transactions_.erase(pending_transactions_.begin());
673 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) 676 if (pending_transactions_.empty() && !changes_acked_callback_.is_null())
674 changes_acked_callback_.Run(); 677 changes_acked_callback_.Run();
675 } 678 }
676 679
677 } // namespace view_manager 680 } // namespace view_manager
678 } // namespace mojo 681 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698