| OLD | NEW |
| 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/context/blimp_client_context_impl.h" | 5 #include "blimp/client/core/context/blimp_client_context_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 const char kDefaultAssignerUrl[] = | 46 const char kDefaultAssignerUrl[] = |
| 47 "https://blimp-pa.googleapis.com/v1/assignment"; | 47 "https://blimp-pa.googleapis.com/v1/assignment"; |
| 48 | 48 |
| 49 void DropConnectionOnIOThread(ClientNetworkComponents* net_components) { | 49 void DropConnectionOnIOThread(ClientNetworkComponents* net_components) { |
| 50 net_components->GetBrowserConnectionHandler()->DropCurrentConnection(); | 50 net_components->GetBrowserConnectionHandler()->DropCurrentConnection(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void AppendDefaultCommandLineFlags(base::CommandLine* command_line) { | |
| 54 // Enables the updated compositing path before any tabs are created. | |
| 55 command_line->AppendSwitch(switches::kEnableUpdatedCompositingPath); | |
| 56 } | |
| 57 | |
| 58 } // namespace | 53 } // namespace |
| 59 | 54 |
| 60 // This function is declared in //blimp/client/public/blimp_client_context.h, | 55 // This function is declared in //blimp/client/public/blimp_client_context.h, |
| 61 // and either this function or the one in | 56 // and either this function or the one in |
| 62 // //blimp/client/core/dummy_blimp_client_context.cc should be linked in to | 57 // //blimp/client/core/dummy_blimp_client_context.cc should be linked in to |
| 63 // any binary using BlimpClientContext::Create. | 58 // any binary using BlimpClientContext::Create. |
| 64 // static | 59 // static |
| 65 BlimpClientContext* BlimpClientContext::Create( | 60 BlimpClientContext* BlimpClientContext::Create( |
| 66 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 61 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
| 67 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | 62 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 settings_feature_->PushSettings(); | 135 settings_feature_->PushSettings(); |
| 141 | 136 |
| 142 connection_status_.AddObserver(this); | 137 connection_status_.AddObserver(this); |
| 143 | 138 |
| 144 // Initialize must only be posted after the features have been | 139 // Initialize must only be posted after the features have been |
| 145 // registered. | 140 // registered. |
| 146 io_thread_task_runner_->PostTask( | 141 io_thread_task_runner_->PostTask( |
| 147 FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize, | 142 FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize, |
| 148 base::Unretained(net_components_.get()))); | 143 base::Unretained(net_components_.get()))); |
| 149 | 144 |
| 150 AppendDefaultCommandLineFlags(base::CommandLine::ForCurrentProcess()); | |
| 151 | |
| 152 UMA_HISTOGRAM_BOOLEAN("Blimp.Supported", true); | 145 UMA_HISTOGRAM_BOOLEAN("Blimp.Supported", true); |
| 153 } | 146 } |
| 154 | 147 |
| 155 BlimpClientContextImpl::~BlimpClientContextImpl() { | 148 BlimpClientContextImpl::~BlimpClientContextImpl() { |
| 156 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); | 149 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); |
| 157 connection_status_.RemoveObserver(this); | 150 connection_status_.RemoveObserver(this); |
| 158 } | 151 } |
| 159 | 152 |
| 160 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { | 153 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { |
| 161 DCHECK(!delegate_ || !delegate); | 154 DCHECK(!delegate_ || !delegate); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (result >= 0) { | 283 if (result >= 0) { |
| 291 delegate_->OnEngineDisconnected(result); | 284 delegate_->OnEngineDisconnected(result); |
| 292 } else { | 285 } else { |
| 293 delegate_->OnNetworkDisconnected(result); | 286 delegate_->OnNetworkDisconnected(result); |
| 294 } | 287 } |
| 295 } | 288 } |
| 296 } | 289 } |
| 297 | 290 |
| 298 } // namespace client | 291 } // namespace client |
| 299 } // namespace blimp | 292 } // namespace blimp |
| OLD | NEW |