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

Side by Side Diff: blimp/client/core/contents/blimp_contents_manager.cc

Issue 2241623002: blimp: Move compositing, input and render widget feature to client/core. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments from #7 Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "blimp/client/core/contents/blimp_contents_manager.h" 5 #include "blimp/client/core/contents/blimp_contents_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "blimp/client/core/compositor/compositor_deps_provider.h"
10 #include "blimp/client/public/contents/blimp_contents_observer.h" 11 #include "blimp/client/public/contents/blimp_contents_observer.h"
11 12
12 namespace { 13 namespace {
13 const int kDummyTabId = 0; 14 const int kDummyTabId = 0;
14 } 15 }
15 16
16 namespace blimp { 17 namespace blimp {
17 namespace client { 18 namespace client {
18 19
19 class BlimpContentsManager::BlimpContentsDeletionObserver 20 class BlimpContentsManager::BlimpContentsDeletionObserver
(...skipping 20 matching lines...) Expand all
40 void BlimpContentsManager::BlimpContentsDeletionObserver:: 41 void BlimpContentsManager::BlimpContentsDeletionObserver::
41 OnContentsDestroyed() { 42 OnContentsDestroyed() {
42 BlimpContents* contents = blimp_contents(); 43 BlimpContents* contents = blimp_contents();
43 int id = static_cast<BlimpContentsImpl*>(contents)->id(); 44 int id = static_cast<BlimpContentsImpl*>(contents)->id();
44 DCHECK(base::ThreadTaskRunnerHandle::Get()); 45 DCHECK(base::ThreadTaskRunnerHandle::Get());
45 base::ThreadTaskRunnerHandle::Get()->PostTask( 46 base::ThreadTaskRunnerHandle::Get()->PostTask(
46 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap, 47 FROM_HERE, base::Bind(&BlimpContentsManager::EraseObserverFromMap,
47 blimp_contents_manager_->GetWeakPtr(), id)); 48 blimp_contents_manager_->GetWeakPtr(), id));
48 } 49 }
49 50
50 BlimpContentsManager::BlimpContentsManager() : weak_ptr_factory_(this) {} 51 BlimpContentsManager::BlimpContentsManager(
52 RenderWidgetFeature* render_widget_feature)
53 : render_widget_feature_(render_widget_feature), weak_ptr_factory_(this) {}
51 54
52 BlimpContentsManager::~BlimpContentsManager() {} 55 BlimpContentsManager::~BlimpContentsManager() {}
53 56
54 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents() { 57 std::unique_ptr<BlimpContentsImpl> BlimpContentsManager::CreateBlimpContents() {
55 int id = CreateBlimpContentsId(); 58 int id = CreateBlimpContentsId();
56 std::unique_ptr<BlimpContentsImpl> new_contents = 59 std::unique_ptr<BlimpContentsImpl> new_contents =
57 base::MakeUnique<BlimpContentsImpl>(id); 60 base::MakeUnique<BlimpContentsImpl>(id, render_widget_feature_);
58 std::unique_ptr<BlimpContentsDeletionObserver> observer = 61 std::unique_ptr<BlimpContentsDeletionObserver> observer =
59 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get()); 62 base::MakeUnique<BlimpContentsDeletionObserver>(this, new_contents.get());
60 observer_map_.insert( 63 observer_map_.insert(
61 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>( 64 std::pair<int, std::unique_ptr<BlimpContentsDeletionObserver>>(
62 id, std::move(observer))); 65 id, std::move(observer)));
63 return new_contents; 66 return new_contents;
64 } 67 }
65 68
66 BlimpContentsImpl* BlimpContentsManager::GetBlimpContents(int id) { 69 BlimpContentsImpl* BlimpContentsManager::GetBlimpContents(int id) {
67 if (observer_map_.find(id) == observer_map_.end()) return nullptr; 70 if (observer_map_.find(id) == observer_map_.end()) return nullptr;
(...skipping 18 matching lines...) Expand all
86 void BlimpContentsManager::EraseObserverFromMap(int id) { 89 void BlimpContentsManager::EraseObserverFromMap(int id) {
87 observer_map_.erase(id); 90 observer_map_.erase(id);
88 } 91 }
89 92
90 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() { 93 base::WeakPtr<BlimpContentsManager> BlimpContentsManager::GetWeakPtr() {
91 return weak_ptr_factory_.GetWeakPtr(); 94 return weak_ptr_factory_.GetWeakPtr();
92 } 95 }
93 96
94 } // namespace client 97 } // namespace client
95 } // namespace blimp 98 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698