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

Side by Side Diff: services/ui/ws/window_tree_binding.cc

Issue 2352893002: Makes windowserver not send messages during shutdown (Closed)
Patch Set: merge Created 4 years, 3 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 | « services/ui/ws/window_tree_binding.h ('k') | services/ui/ws/window_tree_unittest.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 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 "services/ui/ws/window_tree_binding.h" 5 #include "services/ui/ws/window_tree_binding.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "services/ui/ws/window_server.h" 8 #include "services/ui/ws/window_server.h"
9 #include "services/ui/ws/window_tree.h" 9 #include "services/ui/ws/window_tree.h"
10 10
11 namespace ui { 11 namespace ui {
12 namespace ws { 12 namespace ws {
13 13
14 WindowTreeBinding::WindowTreeBinding(mojom::WindowTreeClient* client) 14 WindowTreeBinding::WindowTreeBinding(mojom::WindowTreeClient* client)
15 : client_(client) {} 15 : client_(client) {}
16 16
17 WindowTreeBinding::~WindowTreeBinding() {} 17 WindowTreeBinding::~WindowTreeBinding() {}
18 18
19 void WindowTreeBinding::ResetClientForShutdown() {
20 client_ = CreateClientForShutdown();
21 }
22
19 DefaultWindowTreeBinding::DefaultWindowTreeBinding( 23 DefaultWindowTreeBinding::DefaultWindowTreeBinding(
20 WindowTree* tree, 24 WindowTree* tree,
21 WindowServer* window_server, 25 WindowServer* window_server,
22 mojom::WindowTreeRequest service_request, 26 mojom::WindowTreeRequest service_request,
23 mojom::WindowTreeClientPtr client) 27 mojom::WindowTreeClientPtr client)
24 : WindowTreeBinding(client.get()), 28 : WindowTreeBinding(client.get()),
25 binding_(tree, std::move(service_request)), 29 binding_(tree, std::move(service_request)),
26 client_(std::move(client)) { 30 client_(std::move(client)) {
27 // Both |window_server| and |tree| outlive us. 31 // Both |window_server| and |tree| outlive us.
28 binding_.set_connection_error_handler( 32 binding_.set_connection_error_handler(
29 base::Bind(&WindowServer::DestroyTree, base::Unretained(window_server), 33 base::Bind(&WindowServer::DestroyTree, base::Unretained(window_server),
30 base::Unretained(tree))); 34 base::Unretained(tree)));
31 } 35 }
32 36
33 DefaultWindowTreeBinding::DefaultWindowTreeBinding( 37 DefaultWindowTreeBinding::DefaultWindowTreeBinding(
34 WindowTree* tree, 38 WindowTree* tree,
35 mojom::WindowTreeClientPtr client) 39 mojom::WindowTreeClientPtr client)
36 : WindowTreeBinding(client.get()), 40 : WindowTreeBinding(client.get()),
37 binding_(tree), 41 binding_(tree),
38 client_(std::move(client)) {} 42 client_(std::move(client)) {}
39 43
40 DefaultWindowTreeBinding::~DefaultWindowTreeBinding() {} 44 DefaultWindowTreeBinding::~DefaultWindowTreeBinding() {}
41 45
42 void DefaultWindowTreeBinding::SetIncomingMethodCallProcessingPaused(
43 bool paused) {
44 if (paused)
45 binding_.PauseIncomingMethodCallProcessing();
46 else
47 binding_.ResumeIncomingMethodCallProcessing();
48 }
49
50 mojom::WindowTreePtr DefaultWindowTreeBinding::CreateInterfacePtrAndBind() { 46 mojom::WindowTreePtr DefaultWindowTreeBinding::CreateInterfacePtrAndBind() {
51 DCHECK(!binding_.is_bound()); 47 DCHECK(!binding_.is_bound());
52 return binding_.CreateInterfacePtrAndBind(); 48 return binding_.CreateInterfacePtrAndBind();
53 } 49 }
54 50
55 mojom::WindowManager* DefaultWindowTreeBinding::GetWindowManager() { 51 mojom::WindowManager* DefaultWindowTreeBinding::GetWindowManager() {
56 client_->GetWindowManager( 52 client_->GetWindowManager(
57 GetProxy(&window_manager_internal_, client_.associated_group())); 53 GetProxy(&window_manager_internal_, client_.associated_group()));
58 return window_manager_internal_.get(); 54 return window_manager_internal_.get();
59 } 55 }
60 56
57 void DefaultWindowTreeBinding::SetIncomingMethodCallProcessingPaused(
58 bool paused) {
59 if (paused)
60 binding_.PauseIncomingMethodCallProcessing();
61 else
62 binding_.ResumeIncomingMethodCallProcessing();
63 }
64
65 mojom::WindowTreeClient* DefaultWindowTreeBinding::CreateClientForShutdown() {
66 client_.reset();
67 GetProxy(&client_);
68 return client_.get();
69 }
70
61 } // namespace ws 71 } // namespace ws
62 } // namespace ui 72 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree_binding.h ('k') | services/ui/ws/window_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698