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

Side by Side Diff: chrome/browser/memory/tab_manager_delegate_chromeos.cc

Issue 2171123002: chrome/browser/memory: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/memory/tab_manager_delegate_chromeos.h" 5 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 arc_process_instance_(nullptr), 330 arc_process_instance_(nullptr),
331 arc_process_instance_version_(0), 331 arc_process_instance_version_(0),
332 uma_(new UmaReporter()), 332 uma_(new UmaReporter()),
333 weak_ptr_factory_(this) { 333 weak_ptr_factory_(this) {
334 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 334 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
335 content::NotificationService::AllBrowserContextsAndSources()); 335 content::NotificationService::AllBrowserContextsAndSources());
336 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 336 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
337 content::NotificationService::AllBrowserContextsAndSources()); 337 content::NotificationService::AllBrowserContextsAndSources());
338 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, 338 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
339 content::NotificationService::AllBrowserContextsAndSources()); 339 content::NotificationService::AllBrowserContextsAndSources());
340 auto arc_bridge_service = arc::ArcBridgeService::Get(); 340 auto* arc_bridge_service = arc::ArcBridgeService::Get();
341 if (arc_bridge_service) 341 if (arc_bridge_service)
342 arc_bridge_service->process()->AddObserver(this); 342 arc_bridge_service->process()->AddObserver(this);
343 auto activation_client = GetActivationClient(); 343 auto* activation_client = GetActivationClient();
344 if (activation_client) 344 if (activation_client)
345 activation_client->AddObserver(this); 345 activation_client->AddObserver(this);
346 BrowserList::GetInstance()->AddObserver(this); 346 BrowserList::GetInstance()->AddObserver(this);
347 } 347 }
348 348
349 TabManagerDelegate::~TabManagerDelegate() { 349 TabManagerDelegate::~TabManagerDelegate() {
350 BrowserList::GetInstance()->RemoveObserver(this); 350 BrowserList::GetInstance()->RemoveObserver(this);
351 auto activation_client = GetActivationClient(); 351 auto* activation_client = GetActivationClient();
352 if (activation_client) 352 if (activation_client)
353 activation_client->RemoveObserver(this); 353 activation_client->RemoveObserver(this);
354 auto arc_bridge_service = arc::ArcBridgeService::Get(); 354 auto* arc_bridge_service = arc::ArcBridgeService::Get();
355 if (arc_bridge_service) 355 if (arc_bridge_service)
356 arc_bridge_service->process()->RemoveObserver(this); 356 arc_bridge_service->process()->RemoveObserver(this);
357 } 357 }
358 358
359 void TabManagerDelegate::OnBrowserSetLastActive(Browser* browser) { 359 void TabManagerDelegate::OnBrowserSetLastActive(Browser* browser) {
360 // Set OOM score to the selected tab when a browser window is activated. 360 // Set OOM score to the selected tab when a browser window is activated.
361 // content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED didn't catch the 361 // content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED didn't catch the
362 // case (like when switching focus between 2 browser windows) so we need to 362 // case (like when switching focus between 2 browser windows) so we need to
363 // handle it here. 363 // handle it here.
364 TabStripModel* tab_strip_model = browser->tab_strip_model(); 364 TabStripModel* tab_strip_model = browser->tab_strip_model();
365 int selected_index = tab_strip_model->active_index(); 365 int selected_index = tab_strip_model->active_index();
366 content::WebContents* contents = 366 content::WebContents* contents =
367 tab_strip_model->GetWebContentsAt(selected_index); 367 tab_strip_model->GetWebContentsAt(selected_index);
368 if (!contents) 368 if (!contents)
369 return; 369 return;
370 370
371 base::ProcessHandle pid = contents->GetRenderProcessHost()->GetHandle(); 371 base::ProcessHandle pid = contents->GetRenderProcessHost()->GetHandle();
372 AdjustFocusedTabScore(pid); 372 AdjustFocusedTabScore(pid);
373 } 373 }
374 374
375 void TabManagerDelegate::OnInstanceReady() { 375 void TabManagerDelegate::OnInstanceReady() {
376 auto arc_bridge_service = arc::ArcBridgeService::Get(); 376 auto* arc_bridge_service = arc::ArcBridgeService::Get();
377 DCHECK(arc_bridge_service); 377 DCHECK(arc_bridge_service);
378 378
379 arc_process_instance_ = arc_bridge_service->process()->instance(); 379 arc_process_instance_ = arc_bridge_service->process()->instance();
380 arc_process_instance_version_ = arc_bridge_service->process()->version(); 380 arc_process_instance_version_ = arc_bridge_service->process()->version();
381 381
382 DCHECK(arc_process_instance_); 382 DCHECK(arc_process_instance_);
383 383
384 if (!IsArcMemoryManagementEnabled()) 384 if (!IsArcMemoryManagementEnabled())
385 return; 385 return;
386 386
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 } 830 }
831 } 831 }
832 priority += priority_increment; 832 priority += priority_increment;
833 } 833 }
834 834
835 if (oom_score_for_tabs.size()) 835 if (oom_score_for_tabs.size())
836 SetOomScoreAdjForTabs(oom_score_for_tabs); 836 SetOomScoreAdjForTabs(oom_score_for_tabs);
837 } 837 }
838 838
839 } // namespace memory 839 } // namespace memory
OLDNEW
« no previous file with comments | « chrome/browser/memory/tab_manager_browsertest.cc ('k') | chrome/browser/memory/tab_manager_observer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698