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

Side by Side Diff: content/renderer/render_widget.cc

Issue 17355004: Apply artificial memory pressure when backgrounded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | « content/renderer/render_thread_impl.cc ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/common/view_messages.h" 23 #include "content/common/view_messages.h"
24 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
25 #include "content/renderer/gpu/compositor_output_surface.h" 25 #include "content/renderer/gpu/compositor_output_surface.h"
26 #include "content/renderer/gpu/compositor_software_output_device.h" 26 #include "content/renderer/gpu/compositor_software_output_device.h"
27 #include "content/renderer/gpu/delegated_compositor_output_surface.h" 27 #include "content/renderer/gpu/delegated_compositor_output_surface.h"
28 #include "content/renderer/gpu/input_handler_manager.h" 28 #include "content/renderer/gpu/input_handler_manager.h"
29 #include "content/renderer/gpu/mailbox_output_surface.h" 29 #include "content/renderer/gpu/mailbox_output_surface.h"
30 #include "content/renderer/gpu/render_widget_compositor.h" 30 #include "content/renderer/gpu/render_widget_compositor.h"
31 #include "content/renderer/ime_event_guard.h" 31 #include "content/renderer/ime_event_guard.h"
32 #include "content/renderer/render_process.h" 32 #include "content/renderer/render_process.h"
33 #include "content/renderer/render_process_visibility_manager.h"
33 #include "content/renderer/render_thread_impl.h" 34 #include "content/renderer/render_thread_impl.h"
34 #include "content/renderer/renderer_webkitplatformsupport_impl.h" 35 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
35 #include "ipc/ipc_sync_message.h" 36 #include "ipc/ipc_sync_message.h"
36 #include "skia/ext/platform_canvas.h" 37 #include "skia/ext/platform_canvas.h"
37 #include "third_party/WebKit/public/web/WebCursorInfo.h" 38 #include "third_party/WebKit/public/web/WebCursorInfo.h"
38 #include "third_party/WebKit/public/web/WebHelperPlugin.h" 39 #include "third_party/WebKit/public/web/WebHelperPlugin.h"
39 #include "third_party/WebKit/public/web/WebPagePopup.h" 40 #include "third_party/WebKit/public/web/WebPagePopup.h"
40 #include "third_party/WebKit/public/web/WebPopupMenu.h" 41 #include "third_party/WebKit/public/web/WebPopupMenu.h"
41 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h" 42 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h"
42 #include "third_party/WebKit/public/web/WebRange.h" 43 #include "third_party/WebKit/public/web/WebRange.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 is_threaded_compositing_enabled_(false), 182 is_threaded_compositing_enabled_(false),
182 weak_ptr_factory_(this) { 183 weak_ptr_factory_(this) {
183 if (!swapped_out) 184 if (!swapped_out)
184 RenderProcess::current()->AddRefProcess(); 185 RenderProcess::current()->AddRefProcess();
185 DCHECK(RenderThread::Get()); 186 DCHECK(RenderThread::Get());
186 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( 187 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch(
187 switches::kDisableGpuVsync); 188 switches::kDisableGpuVsync);
188 is_threaded_compositing_enabled_ = 189 is_threaded_compositing_enabled_ =
189 CommandLine::ForCurrentProcess()->HasSwitch( 190 CommandLine::ForCurrentProcess()->HasSwitch(
190 switches::kEnableThreadedCompositing); 191 switches::kEnableThreadedCompositing);
192
193 RenderProcessVisibilityManager::GetInstance()->WidgetVisibilityChanged(true);
191 } 194 }
192 195
193 RenderWidget::~RenderWidget() { 196 RenderWidget::~RenderWidget() {
194 DCHECK(!webwidget_) << "Leaking our WebWidget!"; 197 DCHECK(!webwidget_) << "Leaking our WebWidget!";
195 STLDeleteElements(&updates_pending_swap_); 198 STLDeleteElements(&updates_pending_swap_);
196 if (current_paint_buf_) { 199 if (current_paint_buf_) {
197 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); 200 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_);
198 current_paint_buf_ = NULL; 201 current_paint_buf_ = NULL;
199 } 202 }
200 // If we are swapped out, we have released already. 203 // If we are swapped out, we have released already.
(...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2405 2408
2406 if (!context->InitializeWithDefaultBufferSizes( 2409 if (!context->InitializeWithDefaultBufferSizes(
2407 attributes, 2410 attributes,
2408 false /* bind generates resources */, 2411 false /* bind generates resources */,
2409 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) 2412 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) )
2410 return NULL; 2413 return NULL;
2411 return context.release(); 2414 return context.release();
2412 } 2415 }
2413 2416
2414 } // namespace content 2417 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698