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

Side by Side Diff: content/browser/android/synchronous_compositor_observer.cc

Issue 2228403003: content: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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
« no previous file with comments | « no previous file | content/browser/appcache/appcache.cc » ('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 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 "content/browser/android/synchronous_compositor_observer.h" 5 #include "content/browser/android/synchronous_compositor_observer.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 15 matching lines...) Expand all
26 auto itr = g_instances.Get().find(process_id); 26 auto itr = g_instances.Get().find(process_id);
27 if (itr != g_instances.Get().end()) 27 if (itr != g_instances.Get().end())
28 return itr->second; 28 return itr->second;
29 return new SynchronousCompositorObserver(process_id); 29 return new SynchronousCompositorObserver(process_id);
30 } 30 }
31 31
32 SynchronousCompositorObserver::SynchronousCompositorObserver(int process_id) 32 SynchronousCompositorObserver::SynchronousCompositorObserver(int process_id)
33 : render_process_host_(RenderProcessHost::FromID(process_id)), 33 : render_process_host_(RenderProcessHost::FromID(process_id)),
34 window_android_in_vsync_(nullptr) { 34 window_android_in_vsync_(nullptr) {
35 DCHECK(render_process_host_); 35 DCHECK(render_process_host_);
36 DCHECK(!ContainsKey(g_instances.Get(), render_process_host_->GetID())); 36 DCHECK(!base::ContainsKey(g_instances.Get(), render_process_host_->GetID()));
37 g_instances.Get()[render_process_host_->GetID()] = this; 37 g_instances.Get()[render_process_host_->GetID()] = this;
38 render_process_host_->AddObserver(this); 38 render_process_host_->AddObserver(this);
39 } 39 }
40 40
41 SynchronousCompositorObserver::~SynchronousCompositorObserver() { 41 SynchronousCompositorObserver::~SynchronousCompositorObserver() {
42 DCHECK(compositor_host_pending_renderer_state_.empty()); 42 DCHECK(compositor_host_pending_renderer_state_.empty());
43 DCHECK(ContainsKey(g_instances.Get(), render_process_host_->GetID())); 43 DCHECK(base::ContainsKey(g_instances.Get(), render_process_host_->GetID()));
44 DCHECK_EQ(this, g_instances.Get()[render_process_host_->GetID()]); 44 DCHECK_EQ(this, g_instances.Get()[render_process_host_->GetID()]);
45 render_process_host_->RemoveObserver(this); 45 render_process_host_->RemoveObserver(this);
46 g_instances.Get().erase(render_process_host_->GetID()); 46 g_instances.Get().erase(render_process_host_->GetID());
47 } 47 }
48 48
49 void SynchronousCompositorObserver::RenderProcessHostDestroyed( 49 void SynchronousCompositorObserver::RenderProcessHostDestroyed(
50 RenderProcessHost* host) { 50 RenderProcessHost* host) {
51 DCHECK_EQ(render_process_host_, host); 51 DCHECK_EQ(render_process_host_, host);
52 delete this; 52 delete this;
53 } 53 }
54 54
55 void SynchronousCompositorObserver::SyncStateAfterVSync( 55 void SynchronousCompositorObserver::SyncStateAfterVSync(
56 ui::WindowAndroid* window_android, 56 ui::WindowAndroid* window_android,
57 SynchronousCompositorHost* compositor_host) { 57 SynchronousCompositorHost* compositor_host) {
58 DCHECK(!window_android_in_vsync_ || 58 DCHECK(!window_android_in_vsync_ ||
59 window_android_in_vsync_ == window_android) 59 window_android_in_vsync_ == window_android)
60 << !!window_android_in_vsync_; 60 << !!window_android_in_vsync_;
61 DCHECK(compositor_host); 61 DCHECK(compositor_host);
62 DCHECK( 62 DCHECK(!base::ContainsValue(compositor_host_pending_renderer_state_,
63 !ContainsValue(compositor_host_pending_renderer_state_, compositor_host)); 63 compositor_host));
64 compositor_host_pending_renderer_state_.push_back(compositor_host); 64 compositor_host_pending_renderer_state_.push_back(compositor_host);
65 if (window_android_in_vsync_) 65 if (window_android_in_vsync_)
66 return; 66 return;
67 window_android_in_vsync_ = window_android; 67 window_android_in_vsync_ = window_android;
68 window_android_in_vsync_->AddObserver(this); 68 window_android_in_vsync_->AddObserver(this);
69 } 69 }
70 70
71 void SynchronousCompositorObserver::OnCompositingDidCommit() { 71 void SynchronousCompositorObserver::OnCompositingDidCommit() {
72 NOTREACHED(); 72 NOTREACHED();
73 } 73 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 void SynchronousCompositorObserver::OnActivityStopped() { 123 void SynchronousCompositorObserver::OnActivityStopped() {
124 NOTREACHED(); 124 NOTREACHED();
125 } 125 }
126 126
127 void SynchronousCompositorObserver::OnActivityStarted() { 127 void SynchronousCompositorObserver::OnActivityStarted() {
128 NOTREACHED(); 128 NOTREACHED();
129 } 129 }
130 130
131 } // namespace content 131 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/appcache/appcache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698